Skip to content

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

Merged
merged 1 commit into from
Mar 24, 2014

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 21, 2014

The phase is now always the phase on which the denotation transformer is defined.

@odersky
Copy link
Contributor Author

odersky commented Mar 21, 2014

@review by @gzm0 @DarkDimius

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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)

@gzm0
Copy link
Contributor

gzm0 commented Mar 21, 2014

LGTM otherwise.

The phase is now always the phase on which the denotation transformer is defined.
@DarkDimius
Copy link
Contributor

LGTM

DarkDimius added a commit that referenced this pull request Mar 24, 2014
Fix phase of context for denotation transformer
@DarkDimius DarkDimius merged commit d698528 into scala:master Mar 24, 2014
DarkDimius added a commit that referenced this pull request Mar 24, 2014
Fix phase of context for denotation transformer
DarkDimius added a commit that referenced this pull request Mar 24, 2014
Fix phase of context for denotation transformer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants