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
Terraform modules
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
Gesh
GHC
Commits
38060280
Commit
38060280
authored
26 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-12-21 09:37:54 by simonpj]
Fix two minor typechecker bugs
parent
7e602b0a
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ghc/compiler/typecheck/TcMatches.lhs
+1
-1
1 addition, 1 deletion
ghc/compiler/typecheck/TcMatches.lhs
ghc/compiler/typecheck/TcTyDecls.lhs
+16
-7
16 additions, 7 deletions
ghc/compiler/typecheck/TcTyDecls.lhs
with
17 additions
and
8 deletions
ghc/compiler/typecheck/TcMatches.lhs
+
1
−
1
View file @
38060280
...
...
@@ -207,7 +207,7 @@ tcMatch xve1 match@(Match sig_tvs pats maybe_rhs_sig grhss) expected_ty ctxt
grhss'' = glue_on Recursive ex_binds $
glue_on Recursive inst_binds grhss'
in
returnTc (pat_ids, (Match [] pats' Nothing grhss', lie_req''))
returnTc (pat_ids, (Match [] pats' Nothing grhss'
'
, lie_req''))
-- glue_on just avoids stupid dross
glue_on _ EmptyMonoBinds grhss = grhss -- The common case
...
...
This diff is collapsed.
Click to expand it.
ghc/compiler/typecheck/TcTyDecls.lhs
+
16
−
7
View file @
38060280
...
...
@@ -24,6 +24,7 @@ import TcMonoType ( tcExtendTopTyVarScope, tcExtendTyVarScope,
tcHsTypeKind, tcHsType, tcHsTopType, tcHsTopBoxedType,
tcContext
)
import TcType ( zonkTcTyVarToTyVar, zonkTcThetaType )
import TcEnv ( tcLookupTy, TcTyThing(..) )
import TcMonad
import TcUnify ( unifyKind )
...
...
@@ -176,13 +177,13 @@ tc_con_decl_help tycon tyvars ctxt name ex_tyvars ex_theta details
tys = map get_pty btys
in
mapTc tcHsTopType tys `thenTc` \ arg_tys ->
returnTc (
mk_data_con arg_stricts arg_tys []
)
mk_data_con arg_stricts arg_tys []
tc_newcon ty
= tcHsTopBoxedType ty `thenTc` \ arg_ty ->
-- can't allow an unboxed type here, because we're effectively
-- going to remove the constructor while coercing it to a boxed type.
returnTc (
mk_data_con [NotMarkedStrict] [arg_ty] []
)
mk_data_con [NotMarkedStrict] [arg_ty] []
tc_rec_con fields
= checkTc (null ex_tyvars) (exRecConErr name) `thenTc_`
...
...
@@ -195,21 +196,29 @@ tc_con_decl_help tycon tyvars ctxt name ex_tyvars ex_theta details
field_labels = [ mkFieldLabel (getName name) ty tag
| ((name, ty, _), tag) <- field_label_infos `zip` allFieldLabelTags ]
in
returnTc (
mk_data_con arg_stricts arg_tys field_labels
)
mk_data_con arg_stricts arg_tys field_labels
tc_field (field_label_names, bty)
= tcHsTopType (get_pty bty) `thenTc` \ field_ty ->
returnTc [(name, field_ty, get_strictness bty) | name <- field_label_names]
mk_data_con arg_stricts arg_tys fields = data_con
where
mk_data_con arg_stricts arg_tys fields
= -- Now we've checked all the field types we must
-- zonk the existential tyvars to finish the kind
-- inference on their kinds, and commit them to being
-- immutable type variables. (The top-level tyvars are
-- already fixed, by the preceding kind-inference pass.)
mapNF_Tc zonkTcTyVarToTyVar ex_tyvars `thenNF_Tc` \ ex_tyvars' ->
zonkTcThetaType ex_theta `thenNF_Tc` \ ex_theta' ->
let
data_con = mkDataCon name arg_stricts fields
tyvars (thinContext arg_tys ctxt)
ex_tyvars ex_theta
ex_tyvars
'
ex_theta
'
arg_tys
tycon data_con_id
data_con_id = mkDataConId data_con
in
returnNF_Tc data_con
-- The context for a data constructor should be limited to
-- the type variables mentioned in the arg_tys
...
...
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