Skip to content

Commit f4f525d

Browse files
committed
update test code
1 parent d93e7c0 commit f4f525d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

sbt-dotty/sbt-test/sbt-dotty/analyzer-plugin/app/Hello.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ package hello
22

33
import lib._
44

5+
case class Student(name: String)
6+
57
class M(val n: Int) {
68
val a = 30 * n
9+
def this(c: Char) = this(c.toInt)
10+
711
class B(x: Int) {
12+
def this(c: Char) = this(c.toInt)
813
val b = x * a
914
def bar(i: Int) = i * x
1015
}
@@ -20,17 +25,17 @@ class M(val n: Int) {
2025
}
2126

2227

23-
object Hello {
28+
object Test {
2429
def testLib: Unit = {
25-
val a = new A(30)
26-
val b = new a.B(24)
30+
val a: A = new A(30)
31+
val b: a.B = new a.B(24)
2732
a.foo(3)
2833
b.bar(9)
2934
}
3035

3136
def testHello: Unit = {
32-
val a = new M(30)
33-
val b = new a.B(24)
37+
val a: M = new M(30)
38+
val b: a.B = new a.B(24)
3439
a.foo(3)
3540
b.bar(9)
3641
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
package lib
22

33
class A(val n: Int) {
4+
def this(c: Char) = this(c.toInt)
5+
46
val a = 30 * n
7+
// val p = Product("x", 100)
8+
59
class B(x: Int) {
10+
def this(c: Char) = this(c.toInt)
611
val b = x * a
712
def bar(i: Int) = i * x
813
}
914

1015
def foo(i: Int) = i * n
1116
}
17+
18+
case class Product(name: String, price: Int)

0 commit comments

Comments
 (0)