diff --git a/tests/init/neg/promotion-segment.scala b/tests/init/neg/promotion-segment.scala new file mode 100644 index 000000000000..56968ce79c56 --- /dev/null +++ b/tests/init/neg/promotion-segment.scala @@ -0,0 +1,12 @@ +class Outer: + trait A: + def foo() = println(m) + + trait B extends A + + class C extends B + + def bar(c: C) = c.foo() + + bar(new C) // error + val m = 10 diff --git a/tests/init/neg/promotion-segment2.scala b/tests/init/neg/promotion-segment2.scala new file mode 100644 index 000000000000..d3ba8dedf0ce --- /dev/null +++ b/tests/init/neg/promotion-segment2.scala @@ -0,0 +1,12 @@ +trait A(o: Outer): + def foo() = println(o.m) + +class Outer: + trait B extends A + + class C extends B with A(this) + + def bar(c: C) = c.foo() + + bar(new C) // error + val m = 10