Skip to content

Fix #1820: make sure outer of traits implemented #1821

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 4 commits into from
Dec 20, 2016

Conversation

liufengyun
Copy link
Contributor

@liufengyun liufengyun commented Dec 17, 2016

Fix #1820: make sure outer of traits implemented.

Review @DarkDimius

Previously, we don't generate `outer` for the anonymous class `new Inner2 {}`.
This is incorrect, as `Inner2 {}` extends `A.Inner`, which requires an outer.

trait A {
  val a = "a"
  trait Inner {
    def f = println(a)
    def h = 3
  }
}

trait B extends A {
  trait Inner2 extends Inner
  new Inner2 {}
}
@liufengyun liufengyun changed the title try fix #1820: make sure outer of traits implemented Fix #1820: make sure outer of traits implemented Dec 19, 2016
@@ -81,14 +81,19 @@ class ExplicitOuter extends MiniPhaseTransform with InfoTransformer { thisTransf
!needsOuterAlways(cls) &&
impl.existsSubTree(referencesOuter(cls, _)))
ensureOuterAccessors(cls)
if (hasOuter(cls)) {

val hasOuterFlag = hasOuter(cls)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename hasOuterFlag to clsHasOuter, or something like this?

I was reading hasOuterFlag as "has the Outer flag set" but of course there is no such flag.
Otherwise LGTM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@odersky I've renamed hasOuterFlag to clsHasOuter in c2bc637 .

@odersky odersky merged commit afa8309 into scala:master Dec 20, 2016
@allanrenucci allanrenucci deleted the fix-i1820 branch December 14, 2017 19:20
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.

2 participants