Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Kaznacheev
GHC
Commits
3a6675f5
There was an error fetching the commit references. Please try again later.
Commit
3a6675f5
authored
12 years ago
by
jpm@cs.ox.ac.uk
Committed by
ian@well-typed.com
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Reject promoted constructors when -XDataKinds is not enabled (FIX #7433)
parent
29bbb9f5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compiler/typecheck/TcHsType.lhs
+4
-1
4 additions, 1 deletion
compiler/typecheck/TcHsType.lhs
compiler/typecheck/TcRnTypes.lhs
+3
-0
3 additions, 0 deletions
compiler/typecheck/TcRnTypes.lhs
with
7 additions
and
1 deletion
compiler/typecheck/TcHsType.lhs
+
4
−
1
View file @
3a6675f5
...
...
@@ -604,7 +604,9 @@ tcTyVar name -- Could be a tyvar, a tycon, or a datacon
AGlobal (ADataCon dc)
| Just tc <- promoteDataCon_maybe dc
-> inst_tycon (mkTyConApp tc) (tyConKind tc)
-> do { data_kinds <- xoptM Opt_DataKinds
; unless data_kinds $ promotionErr name NoDataKinds
; inst_tycon (mkTyConApp tc) (tyConKind tc) }
| otherwise -> failWithTc (quotes (ppr dc) <+> ptext (sLit "of type")
<+> quotes (ppr (dataConUserType dc)) <+> ptext (sLit "is not promotable"))
...
...
@@ -1474,6 +1476,7 @@ promotionErr name err
where
reason = case err of
FamDataConPE -> ptext (sLit "it comes from a data family instance")
NoDataKinds -> ptext (sLit "Perhaps you intended to use -XDataKinds")
_ -> ptext (sLit "it is defined and used in the same recursive group")
\end{code}
...
...
This diff is collapsed.
Click to expand it.
compiler/typecheck/TcRnTypes.lhs
+
3
−
0
View file @
3a6675f5
...
...
@@ -593,6 +593,7 @@ data PromotionErr
| RecDataConPE -- Data constructor in a reuursive loop
-- See Note [ARecDataCon: recusion and promoting data constructors] in TcTyClsDecls
| NoDataKinds -- -XDataKinds not enabled
instance Outputable TcTyThing where -- Debugging only
ppr (AGlobal g) = pprTyThing g
...
...
@@ -610,6 +611,7 @@ instance Outputable PromotionErr where
ppr TyConPE = text "TyConPE"
ppr FamDataConPE = text "FamDataConPE"
ppr RecDataConPE = text "RecDataConPE"
ppr NoDataKinds = text "NoDataKinds"
pprTcTyThingCategory :: TcTyThing -> SDoc
pprTcTyThingCategory (AGlobal thing) = pprTyThingCategory thing
...
...
@@ -623,6 +625,7 @@ pprPECategory ClassPE = ptext (sLit "Class")
pprPECategory TyConPE = ptext (sLit "Type constructor")
pprPECategory FamDataConPE = ptext (sLit "Data constructor")
pprPECategory RecDataConPE = ptext (sLit "Data constructor")
pprPECategory NoDataKinds = ptext (sLit "Data constructor")
\end{code}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment