Skip to content

Commit e3345de

Browse files
committed
Negtests with // error comments
1 parent bf6d805 commit e3345de

39 files changed

+120
-118
lines changed

tests/neg/arrayclone-new.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Test extends dotty.runtime.LegacyApp{
77
}
88

99
object ObjectArrayClone{
10-
val it : Array[String] = Array("1", "0");
10+
val it : Array[String] = Array("1", "0"); // error
1111
val cloned = it.clone();
1212
assert(cloned.sameElements(it));
1313
cloned(0) = "0";
@@ -22,7 +22,7 @@ object PolymorphicArrayClone{
2222
assert(it(0) == one)
2323
}
2424

25-
testIt(Array("one", "two"), "one", "two");
25+
testIt(Array("one", "two"), "one", "two"); // error
2626

2727
class Mangler[T: ClassTag](ts : T*){
2828
// this will always be a BoxedAnyArray even after we've unboxed its contents.

tests/neg/assignments.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ object assignments {
1313
x = x + 1
1414
x *= 2
1515

16-
x_= = 2 // should give missing arguments + reassignment to val
16+
x_= = 2 // error should give missing arguments + // error reassignment to val
1717
}
1818

1919
var c = new C
20-
import c._ // should give: prefix is not stable
20+
import c._ // error should give: prefix is not stable
2121
x = x + 1
2222
x *= 2
2323
}

tests/neg/autoTuplingTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import dotty.language.noAutoTupling
22

33
object autoTuplingNeg {
44

5-
val x = Some(1, 2)
5+
val x = Some(1, 2) // error
66

77
x match {
8-
case Some(a, b) => a + b
8+
case Some(a, b) => a + b // error // error // error
99
case None =>
1010
}
1111
}

tests/neg/blockescapesNeg.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
object blockescapesNeg {
22
def m0 = { object Foo { class Bar { val field = 2 }} ; new Foo.Bar }
3-
m0.field
3+
m0.field // error
44
class A[T]
55
def m1 = { val x = 1; new A[x.type]}
66
}

tests/neg/boundspropagation.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ object test2 {
1313

1414

1515
def f(x: Any): Tree[Null] = x match {
16-
case y: Tree[_] => y
16+
case y: Tree[_] => y // error
1717
}
1818
}
1919
object test3 {
2020
class Tree[+T >: Null]
2121

2222

2323
def f(x: Any): Tree[Null] = x match {
24-
case y: Tree[_] => y
24+
case y: Tree[_] => y // error
2525
}
2626
}
2727

@@ -34,11 +34,11 @@ object test4 {
3434
class Tree[-S, -T >: Option[S]]
3535

3636
def g(x: Any): Tree[_, _ <: Option[N]] = x match {
37-
case y: Tree[_, _] => y
37+
case y: Tree[_, _] => y // error
3838
}
3939
}
4040
}
4141

4242
class Test5 {
43-
"": ({ type U = this.type })#U
43+
"": ({ type U = this.type })#U // error // error
4444
}

tests/neg/companions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object companionsNeg {
88

99
{ object C {
1010
private val p = 1
11-
println(new C().q)
11+
println(new C().q) // error
1212
}}
1313
}
1414

tests/neg/cycles.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
class Foo[T <: U, U <: T]
1+
class Foo[T <: U, U <: T] // error
22

3-
class Bar[T >: T]
3+
class Bar[T >: T] // error
44

55
class A {
66
val x: T = ???
7-
type T <: x.type
7+
type T <: x.type // error
88
}
99

1010
class B {
11-
type T <: x.type
11+
type T <: x.type // error
1212
val x: T = ???
1313
}
1414

1515
class C {
1616
val x: D#T = ???
1717
class D {
18-
type T <: x.type
18+
type T <: x.type // error
1919
val z: x.type = ???
2020
}
2121
}
2222

2323
class E {
2424
class F {
2525
type T <: x.type
26-
val z: x.type = ???
26+
val z: x.type = ??? // error
2727
}
2828
val x: F#T = ???
2929
}
3030

3131
class T1 {
32-
type X = (U, U) // cycle
32+
type X = (U, U) // cycle // error
3333
type U = X & Int
3434
}
3535
class T2 {
36-
type X = (U, U) // cycle
36+
type X = (U, U) // cycle // error
3737
type U = X | Int
3838
}
3939
object T12 {

tests/neg/escapingRefs.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ object O {
33
class B
44
def f[T](x: T, y: T): T = y
55

6-
val x: A = f(new A { }, new B { })
6+
val x: A = f(new A { }, new B { }) // error
77

88
val y = f({ class C { def member: Int = 1 }; new C }, { class C { def member: Int = 1 }; new C })
9-
val z = y.member
9+
val z = y.member // error
1010
}

tests/neg/i0091-infpaths.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ object infpaths {
22

33
object a {
44
trait T { t =>
5-
type M <: t.b.M
5+
type M <: t.b.M // error
66
type T <: a.T
77
val b: t.T
88
}
99
val x: a.T = ???
1010
}
1111

1212
val m1: a.x.M = ???
13-
val m2: a.x.b.M = m1
14-
val m3: a.x.b.b.M = m2
13+
val m2: a.x.b.M = m1 // error
14+
val m3: a.x.b.b.M = m2 // error
1515

1616
}

tests/neg/i0248-inherit-refined.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
object test {
22
class A { type T }
33
type X = A { type T = Int }
4-
class B extends X
4+
class B extends X // error
55
type Y = A & B
6-
class C extends Y
6+
class C extends Y // error
77
type Z = A | B
8-
class D extends Z
9-
abstract class E extends ({ val x: Int })
8+
class D extends Z // error
9+
abstract class E extends ({ val x: Int }) // error
1010
}

0 commit comments

Comments
 (0)