Skip to content

Commit 9e9b980

Browse files
committed
Add tests for unbound wildcard types
1 parent 835c92c commit 9e9b980

File tree

1 file changed

+21
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)