-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix #19202: Passing NotNullInfos to a mutable field of a Completer #19463
Fix #19202: Passing NotNullInfos to a mutable field of a Completer #19463
Conversation
Shall we try giving all the completers a |
Yeah that might be the most sensible approach here, ideally we'd have a base class AbstractCompleter that keeps it abstract too |
(or keep Completer with the same name but make it abstract and add a concrete Term completer?) |
So, I think it is ok to keep NotNullInfos as a mutable field for now. |
b4a293e
to
bc057db
Compare
@@ -784,12 +785,18 @@ class Namer { typer: Typer => | |||
|
|||
protected def localContext(owner: Symbol): FreshContext = ctx.fresh.setOwner(owner).setTree(original) | |||
|
|||
private var myNotNullInfos: List[NotNullInfo] | Null = null | |||
|
|||
/** The context with which this completer was created */ |
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.
The comment should mention that this is affected by setNotNullInfos
Fix #19202
Completing a
Def
requires the new NotNullInfos from previous statements.Originally, we created a new Completer with the new creation ctx in
adaptCreationContext
.However, we should not create a regular Completer for
TypeDef
s.This PR fixes the issue by creating a mutable field for NotNullInfos in Completer,
and the field is updated in
adaptCreationContext
now.There may be a better solution without the mutable field.