Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
661bda52
Commit
661bda52
authored
Apr 24, 2007
by
Simon Marlow
Browse files
convert type variables to TcTyVars, otherwise the typechecker gets confused
parent
fd9c8b7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/main/GHC.hs
View file @
661bda52
...
...
@@ -214,8 +214,11 @@ import NameSet
import
RdrName
import
HsSyn
import
Type
hiding
(
typeKind
)
import
TcType
hiding
(
typeKind
)
import
Id
import
Var
hiding
(
setIdType
)
import
VarEnv
import
VarSet
import
TysPrim
(
alphaTyVars
)
import
TyCon
import
Class
...
...
@@ -2320,13 +2323,22 @@ extendEnvironment hsc_env apStack idsOffsets occs = do
let
(
ids
,
hValues
)
=
unzip
idsVals
new_ids
<-
zipWithM
mkNewId
occs
ids
let
names
=
map
idName
ids
let
tyvars
=
varSetElems
(
tyVarsOfTypes
(
map
idType
new_ids
))
new_tyvars
=
map
(
mkTyVarTy
.
mk_skol
)
tyvars
mk_skol
tyvar
=
mkTcTyVar
(
tyVarName
tyvar
)
(
tyVarKind
tyvar
)
(
SkolemTv
UnkSkol
)
subst
=
mkTvSubst
emptyInScopeSet
(
mkVarEnv
(
zip
tyvars
new_tyvars
))
subst_id
id
=
id
`
setIdType
`
substTy
subst
(
idType
id
)
subst_ids
=
map
subst_id
new_ids
Just
(
ATyCon
unknown_tc
)
<-
tcRnLookupName
hsc_env
unknownTyConName
let
result_name
=
mkSystemVarName
(
mkBuiltinUnique
33
)
FSLIT
(
"_result"
)
result_id
=
Id
.
mkLocalId
result_name
(
mkTyConApp
unknown_tc
[]
)
let
ictxt
=
hsc_IC
hsc_env
rn_env
=
ic_rn_local_env
ictxt
type_env
=
ic_type_env
ictxt
all_new_ids
=
result_id
:
new
_ids
all_new_ids
=
result_id
:
subst
_ids
bound_names
=
map
idName
all_new_ids
new_rn_env
=
extendLocalRdrEnv
rn_env
bound_names
-- Remove any shadowed bindings from the type_env;
...
...
@@ -2345,7 +2357,6 @@ extendEnvironment hsc_env apStack idsOffsets occs = do
where
mkNewId
::
OccName
->
Id
->
IO
Id
mkNewId
occ
id
=
do
ty
<-
instantiateTyVarsToUnknown
hsc_env
let
uniq
=
idUnique
id
loc
=
nameSrcLoc
(
idName
id
)
name
=
mkInternalName
uniq
occ
loc
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment