-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix phase of context for denotation transformer #89
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
Conversation
def withPhase(pid: PhaseId): this.type = withPeriod(Period(runId, pid)) | ||
def withPhase(phase: Phase): this.type = withPhase(phase.id) | ||
override def withPhase(pid: PhaseId): this.type = withPeriod(Period(runId, pid)) | ||
override def withPhase(phase: Phase): this.type = withPhase(phase.id) |
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.
Why would you want to override this? IIUC the superclass implementation does the same.
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.
Good catch. The second withPhase(phase: Phase) in class FreshContext can be deleted.
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 override is required, as otherwise returning type will be Context, and not FreshContext.
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.
Indeed. But that means, and I just realize that, that withPhase
mutates the underlying object depending on its runtime type. @odersky I think this is a very bad idea. The methods should have a different name. (IMHO, the with
methods of FreshContext
should rather be called set
)
LGTM otherwise. |
The phase is now always the phase on which the denotation transformer is defined.
LGTM |
Fix phase of context for denotation transformer
Fix phase of context for denotation transformer
Fix phase of context for denotation transformer
The phase is now always the phase on which the denotation transformer is defined.