Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
clee704 committed Apr 19, 2024
1 parent c142ec3 commit 9831856
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
object App {
def main(args: Array[String]): Unit = {
val b = new B {}
b.foo(1)
b.foo(-1)
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trait A {
def foo(a: Int) = println(s"A.foo $a")
}
trait B extends A
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
trait A {
def foo(a: Int) = println(s"A.foo $a")
}
trait AA extends A {
override def foo(a: Int) = {
if (a > 0) {
println(s"AA.foo $a")
} else {
super.foo(a)
}
}
}
trait B extends AA

0 comments on commit 9831856

Please sign in to comment.