Skip to content

Commit 0e1aaab

Browse files
committed
Add tests for unbound wildcard types
1 parent 1cb67c4 commit 0e1aaab

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/neg/unboundWildcard.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
object unboundWildcard {
2+
3+
// TODO: reactivate tests once they don't crash the compiler anymore
4+
/*
5+
val wildcardVal: _ = 0 // error: unbound wildcard type
6+
7+
val annotated: _ @unchecked = 0 // error: unbound wildcard type
8+
9+
def wildcardArg(x: _): Int = 0 // error: unbound wildcard type
10+
11+
def wildcardResult(x: Int): _ = 0 // error: unbound wildcard type
12+
13+
val singletonTuple: (((((((_))))))) = ??? // error: unbound wildcard type
14+
15+
val wildcardBoundedTypeArgL: List[_ <: _] = List(0) // error: unbound wildcard type
16+
val wildcardBoundedTypeArgU: List[_ >: _] = List(0) // error: unbound wildcard type
17+
18+
def wildcardBoundedTypeParamL[T <: _](x: T): T = x // error: unbound wildcard type
19+
def wildcardBoundedTypeParamU[T >: _](x: T): T = x // error: unbound wildcard type
20+
21+
val _1403: (_ <: Any) = 1 // error: unbound wildcard type*/
22+
}
23+

0 commit comments

Comments
 (0)