Skip to content

Commit

Permalink
Merge pull request #15695 from dotty-staging/zero-init-warnings
Browse files Browse the repository at this point in the history
Add two tests
  • Loading branch information
liufengyun authored Jul 18, 2022
2 parents 776bb11 + f7986c1 commit 67f11ff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/init/neg/promotion-segment.scala
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions tests/init/neg/promotion-segment2.scala
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 67f11ff

Please sign in to comment.