-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for GADTs #195
base: mlscript
Are you sure you want to change the base?
Support for GADTs #195
Conversation
Hit some pp problems due to incorrect use of TypeBounds; need to rm TBs from typer output & use proper wilcards instead We now type patmat branches inside local polymorphic context; this causes regressions in type simplif and some tests to run out of recursion depth limit
TODO add support for raw type
Cool! Will try to take a look later. In the meantime, plz read this again and make sure all the changes are clean: https://github.com/hkust-taco/mlscript/blob/mlscript/CONTRIBUTING.md |
@@ -1147,13 +1147,13 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo | |||
} | |||
val lb = getTypeName("restricts") | |||
val ub = getTypeName("extends") | |||
|
|||
// TODO update `TypeParamInfo` to use lb and ub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
ts2.forall { | ||
case sk: SkolemTag => ts1(sk) | ||
case tt: TraitTag => ts1(tt) | ||
case Extruded(pol, sk) => !pol || ts1.exists { // find ? <: bot | ||
case Extruded(true, _) => true | ||
case _ => false | ||
} | ||
} && rt1 <:< rt2 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thing looks very fishy. What is going on here? Why don't we use the normal set functions?
val cache: MutMap[Level, MutMap[TypeVarOrRigidVar->Bool, TypeVarOrRigidVar]], | ||
) { | ||
private var cycle: Int = 0 | ||
// TODO maybe find a better way |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what this achieves and why it's needed?
…traint rewritings
Add support for GADTs
?
in type argumentsas
keyword for upcast (same as:
)GADT[1-6].mls
ingadt
directory, andAsOp.mls
Some TODOs (added by @LPTK):
local-gadt-wip
after we figure out the new errors??X
types into main branch before merging this PRThe PR has become way too big and it's difficult to keep track of what changes cause what results or regressions. Let's split it up and merge each of these things separately:
?
in type arguments, useas
keyword for upcast (same as:
)App[f, a]
); and in this case don't try to refine these type arguments in the scrutinee.