Commit 1e9a9216 authored by's avatar
Browse files

Fix obscure bug in reportDeprecations

Fixes Trac #1128
Please merge to STABLE

A rather obscure bug related to -fno-implicit-prelude.  
See Note [Used names with interface not loaded] in RnNames.

Easily fixed, however.  Test is rn051
parent 9b1dbf26
......@@ -949,18 +949,34 @@ lookupImpDeprec dflags hpt pit gre
case gre_par gre of
ParentIs p -> mi_dep_fn iface p -- its parent*, is deprec'd
NoParent -> Nothing
| isWiredInName name -> Nothing
-- We have not necessarily loaded the .hi file for a
-- wired-in name (yet), although we *could*.
-- And we never deprecate them
| otherwise -> pprPanic "lookupDeprec" (ppr name)
-- By now all the interfaces should have been loaded
Nothing -> Nothing -- See Note [Used names with interface not loaded]
name = gre_name gre
Note [Used names with interface not loaded]
By now all the interfaces should have been loaded,
because reportDeprecations happens after typechecking.
However, it's still (just) possible to to find a used
Name whose interface hasn't been loaded:
a) It might be a WiredInName; in that case we may not load
its interface (although we could).
b) It might be GHC.Real.fromRational, or GHC.Num.fromInteger
These are seen as "used" by the renamer (if -fno-implicit-prelude)
is on), but the typechecker may discard their uses
if in fact the in-scope fromRational is GHC.Read.fromRational,
(see tcPat.tcOverloadedLit), and the typechecker sees that the type
is fixed, say, to GHC.Base.Float (see Inst.lookupSimpleInst).
In that obscure case it won't force the interface in.
In both cases we simply don't permit deprecations;
this is, after all, wired-in stuff.
%* *
Unused names
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment