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
d3d2b45d
Commit
d3d2b45d
authored
Jan 16, 2008
by
simonpj@microsoft.com
Browse files
Complain sensibly if you try to use scoped type variables in Template Haskell
This fixes Trac
#2024
; worth merging onto 6.8 branch.
parent
47adb8b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/deSugar/DsMeta.hs
View file @
d3d2b45d
...
...
@@ -424,7 +424,7 @@ repTy (HsForAllTy _ tvs ctxt ty) =
repTy
(
HsTyVar
n
)
|
isTvOcc
(
nameOccName
n
)
=
do
tv1
<-
lookup
Binder
n
tv1
<-
lookup
TvOcc
n
repTvar
tv1
|
otherwise
=
do
tc1
<-
lookupOcc
n
...
...
@@ -917,6 +917,18 @@ lookupOcc n
Just
(
Splice
_
)
->
pprPanic
"repE:lookupOcc"
(
ppr
n
)
}
lookupTvOcc
::
Name
->
DsM
(
Core
TH
.
Name
)
-- Type variables can't be staged and are not lexically scoped in TH
lookupTvOcc
n
=
do
{
mb_val
<-
dsLookupMetaEnv
n
;
case
mb_val
of
Just
(
Bound
x
)
->
return
(
coreVar
x
)
other
->
failWithDs
msg
}
where
msg
=
vcat
[
ptext
SLIT
(
"Illegal lexically-scoped type variable"
)
<+>
quotes
(
ppr
n
)
,
ptext
SLIT
(
"Lexically scoped type variables are not supported by Template Haskell"
)
]
globalVar
::
Name
->
DsM
(
Core
TH
.
Name
)
-- Not bound by the meta-env
-- Could be top-level; or could be local
...
...
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