-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ConstraintSystem] Introduce a new type to represent a type hole #33658
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
Changes from all commits
78ea3de
48c9767
d039107
b4d3237
b6c2f89
8f2e53c
9665091
4847ec9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ namespace { | |
} // end anonymous namespace | ||
|
||
void Expr::setType(Type T) { | ||
assert(!T || !T->hasTypeVariable()); | ||
assert(!T || !T->hasTypeVariable() || !T->hasHole()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about creating a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense to me but I think we can't do it at the moment unless |
||
Ty = T; | ||
} | ||
|
||
|
@@ -2001,7 +2001,7 @@ bool ClosureExpr::capturesSelfEnablingImplictSelf() const { | |
} | ||
|
||
void ClosureExpr::setExplicitResultType(Type ty) { | ||
assert(ty && !ty->hasTypeVariable()); | ||
assert(ty && !ty->hasTypeVariable() && !ty->hasHole()); | ||
ExplicitResultTypeAndBodyState.getPointer() | ||
->setType(MetatypeType::get(ty)); | ||
} | ||
|
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.
I believe this is going to always allocate the type in the permanent arena, which is bad if it contains a pointer to a TypeVariableType. The recursive properties used to determine the arena should be the properties of the originator type, not the new properties of the hole type itself.
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.
I didn’t realize that, thank you, Slava!
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.
I need to make sure that types containing holes as well as hole types themselves are allocated in
ConstraintSolver
arena...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.
Fixed! Every type which contains holes or is a
HoleType
itself is not going to be allocated inConstraintSolver
arena. @slavapestov WDYT?