Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,321
Issues
4,321
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
359
Merge Requests
359
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
f4f315a3
Commit
f4f315a3
authored
Mar 16, 2016
by
eir@cis.upenn.edu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
#11512
by getting visibility right for methods
Test case: typecheck/should_compile/T11512
parent
3fe87aa0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
8 deletions
+32
-8
compiler/basicTypes/MkId.hs
compiler/basicTypes/MkId.hs
+14
-5
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcExpr.hs
+4
-1
testsuite/tests/dependent/should_compile/RaeJobTalk.hs
testsuite/tests/dependent/should_compile/RaeJobTalk.hs
+2
-2
testsuite/tests/typecheck/should_compile/T11512.hs
testsuite/tests/typecheck/should_compile/T11512.hs
+11
-0
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_compile/all.T
+1
-0
No files found.
compiler/basicTypes/MkId.hs
View file @
f4f315a3
...
...
@@ -262,9 +262,6 @@ Then the top-level type for op is
forall b. Ord b =>
a -> b -> b
This is unlike ordinary record selectors, which have all the for-alls
at the outside. When dealing with classes it's very convenient to
recover the original type signature from the class op selector.
-}
mkDictSelId
::
Name
-- Name of one of the *value* selectors
...
...
@@ -278,11 +275,23 @@ mkDictSelId name clas
new_tycon
=
isNewTyCon
tycon
[
data_con
]
=
tyConDataCons
tycon
tyvars
=
dataConUnivTyVars
data_con
tc_binders
=
tyConBinders
tycon
arg_tys
=
dataConRepArgTys
data_con
-- Includes the dictionary superclasses
val_index
=
assoc
"MkId.mkDictSelId"
(
sel_names
`
zip
`
[
0
..
])
name
sel_ty
=
mkSpecForAllTys
tyvars
(
mkFunTy
(
mkClassPred
clas
(
mkTyVarTys
tyvars
))
(
getNth
arg_tys
val_index
))
sel_ty
=
mkForAllTys
(
zipWith
mk_binder
tc_binders
tyvars
)
$
mkFunTy
(
mkClassPred
clas
(
mkTyVarTys
tyvars
))
$
getNth
arg_tys
val_index
-- copy the visibility from the tycon binders. Consider:
-- class C a where foo :: Proxy a
-- In the type of foo, `a` must be Specified but `k` must be Invisible
mk_binder
tc_binder
tyvar
|
Invisible
<-
binderVisibility
tc_binder
=
mkNamedBinder
Invisible
tyvar
|
otherwise
=
mkNamedBinder
Specified
tyvar
-- don't just copy from tc_binder, because
-- tc_binders can be Visible
base_info
=
noCafIdInfo
`
setArityInfo
`
1
...
...
compiler/typecheck/TcExpr.hs
View file @
f4f315a3
...
...
@@ -1175,7 +1175,10 @@ tcArgs fun orig_fun_ty fun_orig orig_args herald
;
case
tcSplitForAllTy_maybe
upsilon_ty
of
Just
(
binder
,
inner_ty
)
|
Just
tv
<-
binderVar_maybe
binder
->
ASSERT
(
binderVisibility
binder
==
Specified
)
ASSERT2
(
binderVisibility
binder
==
Specified
,
(
vcat
[
ppr
fun_ty
,
ppr
upsilon_ty
,
ppr
binder
,
ppr
inner_ty
,
pprTvBndr
tv
,
ppr
(
binderVisibility
binder
)
])
)
do
{
let
kind
=
tyVarKind
tv
;
ty_arg
<-
tcHsTypeApp
hs_ty_arg
kind
;
let
insted_ty
=
substTyWithUnchecked
[
tv
]
[
ty_arg
]
inner_ty
...
...
testsuite/tests/dependent/should_compile/RaeJobTalk.hs
View file @
f4f315a3
...
...
@@ -217,7 +217,7 @@ instance TyConAble RuntimeRep where tyCon = RuntimeRep
-- Can't just define Typeable the way we want, because the instances
-- overlap. So we have to mock up instance chains via closed type families.
class
Typeable'
(
a
::
k
)
(
b
::
Bool
)
where
class
Typeable'
a
(
b
::
Bool
)
where
typeRep'
::
TypeRep
a
type
family
CheckPrim
a
where
...
...
@@ -236,7 +236,7 @@ instance (Typeable a, Typeable b) => Typeable' (a b) 'False where
typeRep'
=
TyApp
typeRep
typeRep
typeRep
::
forall
a
.
Typeable
a
=>
TypeRep
a
typeRep
=
typeRep'
@
_
@
_
@
(
CheckPrim
a
)
-- RAE: #11512 says we need the extra @_.
typeRep
=
typeRep'
@
_
@
(
CheckPrim
a
)
-----------------------------
-- Useful instances
...
...
testsuite/tests/typecheck/should_compile/T11512.hs
0 → 100644
View file @
f4f315a3
{-# LANGUAGE PolyKinds, TypeApplications, ScopedTypeVariables #-}
module
Bug
where
import
Data.Proxy
class
C
a
where
foo
::
Proxy
a
bar
::
forall
a
.
C
a
=>
Proxy
a
bar
=
foo
@
a
testsuite/tests/typecheck/should_compile/all.T
View file @
f4f315a3
...
...
@@ -509,3 +509,4 @@ test('T11246', normal, compile, [''])
test
('
T11608
',
normal
,
compile
,
[''])
test
('
T11401
',
normal
,
compile
,
[''])
test
('
T11699
',
normal
,
compile
,
[''])
test
('
T11512
',
normal
,
compile
,
[''])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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