Skip to content

Ensure trait var accessor type is widened#5367

Merged
szeiger merged 1 commit intoscala:2.12.xfrom
adriaanm:fields-widen-trait-var
Aug 29, 2016
Merged

Ensure trait var accessor type is widened#5367
szeiger merged 1 commit intoscala:2.12.xfrom
adriaanm:fields-widen-trait-var

Conversation

@adriaanm
Copy link
Contributor

If we don't widen, we'll fail to find the setter when
typing x = 42, because x is constant-folded to 0,
as its type is => Int(0). After widening, x is
type checked to x and its symbol is the getter in the
trait, which can then be rewritten to the setter.

Regression spotted and test case by @szeiger.

@scala-jenkins scala-jenkins added this to the 2.12.1 milestone Aug 29, 2016
@adriaanm adriaanm modified the milestones: 2.12.0-RC1, 2.12.1 Aug 29, 2016
If we don't widen, we'll fail to find the setter when
typing `x = 42`, because `x` is constant-folded to `0`,
as its type is `=> Int(0)`. After widening, `x` is
type checked to `x` and its symbol is the getter in the
trait, which can then be rewritten to the setter.

Regression spotted and test case by szeiger.
@szeiger
Copy link
Contributor

szeiger commented Aug 29, 2016

LGTM

@szeiger szeiger merged commit 4d3fd6d into scala:2.12.x Aug 29, 2016
szeiger added a commit to szeiger/community-builds that referenced this pull request Aug 29, 2016
Switch to scala/scala-java8-compat#76 which
should work on 2.12.x now that scala/scala#5367
was also merged.
@adriaanm adriaanm added the 2.12 label Oct 29, 2016
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