diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pending/neg/unboundWildcard.scala | 21 | ||||
-rw-r--r-- | tests/pos/wildcardInInfixType.scala | 9 | ||||
-rw-r--r-- | tests/repl/toplevelTry.check | 3 |
3 files changed, 33 insertions, 0 deletions
diff --git a/tests/pending/neg/unboundWildcard.scala b/tests/pending/neg/unboundWildcard.scala new file mode 100644 index 000000000..eeee04fde --- /dev/null +++ b/tests/pending/neg/unboundWildcard.scala @@ -0,0 +1,21 @@ +object unboundWildcard { + + // TODO: move this to tests/neg once it doesn't crash the compiler anymore + val wildcardVal: _ = 0 // error: unbound wildcard type + + val annotated: _ @unchecked = 0 // error: unbound wildcard type + + def wildcardArg(x: _): Int = 0 // error: unbound wildcard type + + def wildcardResult(x: Int): _ = 0 // error: unbound wildcard type + + val singletonTuple: (((((((_))))))) = ??? // error: unbound wildcard type + + val wildcardBoundedTypeArgL: List[_ <: _] = List(0) // error: unbound wildcard type + val wildcardBoundedTypeArgU: List[_ >: _] = List(0) // error: unbound wildcard type + + def wildcardBoundedTypeParamL[T <: _](x: T): T = x // error: unbound wildcard type + def wildcardBoundedTypeParamU[T >: _](x: T): T = x // error: unbound wildcard type + + val _1403: (_ <: Any) = 1 // error: unbound wildcard type +} diff --git a/tests/pos/wildcardInInfixType.scala b/tests/pos/wildcardInInfixType.scala new file mode 100644 index 000000000..9905762c5 --- /dev/null +++ b/tests/pos/wildcardInInfixType.scala @@ -0,0 +1,9 @@ +object wildcardInInfixType { + + val useless: _ => _ = (x: Int) => 1 + + val pointless: (_ <: Int) => _ = (x: Int) => 1 + + val answer: Int Either _ = Left(42) +} + diff --git a/tests/repl/toplevelTry.check b/tests/repl/toplevelTry.check new file mode 100644 index 000000000..9d2c87b35 --- /dev/null +++ b/tests/repl/toplevelTry.check @@ -0,0 +1,3 @@ +scala> try { 0 } catch { _: Throwable => 1 } +res0: Int = 0 +scala> :quit |