Skip to content

Commit 992049a

Browse files
committed
Flags can't be used as non-monotonic signals between phases
since denotations are phase-versioned and later denotations might exist already when the flag of an earlier denotation is set. To avoid this, set flags in all following denotations, not just the current one.
1 parent 51b1f2c commit 992049a

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ class AugmentScala2Traits extends MiniPhase with IdentityDenotTransformer { this
6464
|| sym.isSuperAccessor) // scala2 superaccessors are pickled as private, but are compiled as public expanded
6565
sym.ensureNotPrivate.installAfter(thisPhase)
6666
}
67-
mixin.setFlag(Scala2xPartiallyAugmented)
67+
mixin.transformAfter(thisPhase, d => { d.setFlag(Scala2xPartiallyAugmented); d })
6868
}
6969
}

compiler/src/dotty/tools/dotc/transform/LinkScala2Impls.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class LinkScala2Impls extends MiniPhase with IdentityDenotTransformer { thisPhas
6060
if (needsMixinForwarder(sym) || sym.isConstructor || sym.isGetter && sym.is(Lazy) || sym.is(Method, butNot = Deferred))
6161
newImpl(sym.asTerm).enteredAfter(thisPhase)
6262
// The trait is now fully augmented so the flag isn't needed anymore.
63-
mixin.resetFlag(Scala2xPartiallyAugmented)
63+
mixin.transformAfter(thisPhase, d => { d.resetFlag(Scala2xPartiallyAugmented); d })
6464
}
6565

6666
override def prepareForTemplate(impl: Template)(implicit ctx: Context): Context = {

tests/run/i8101/Foo.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
trait Foo {
2+
def f: String = ???
3+
}

tests/run/i8101/JavaFoo.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public abstract class JavaFoo {
2+
public abstract int read();
3+
}

tests/run/i8101/Test.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Bar extends JavaFoo with Foo {
2+
def read(): Int = ???
3+
}
4+
5+
@main def Test =
6+
val stdout = new Bar

0 commit comments

Comments
 (0)