diff options
author | odersky <odersky@gmail.com> | 2016-08-01 18:36:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-01 18:36:43 +0200 |
commit | 01bd9482d6d1565bfeb17526bed836f0feaeb0d1 (patch) | |
tree | 9e611bf2a1af867f20d14c81b1985eb20faef3b8 /tests | |
parent | 765aecbe3ca4e05c987dde4e868dca08c7585666 (diff) | |
parent | a1d0f3e55afc52457e9e8987d35ef04c04ac0807 (diff) | |
download | dotty-01bd9482d6d1565bfeb17526bed836f0feaeb0d1.tar.gz dotty-01bd9482d6d1565bfeb17526bed836f0feaeb0d1.tar.bz2 dotty-01bd9482d6d1565bfeb17526bed836f0feaeb0d1.zip |
Merge pull request #1431 from cswinter/wip-unboundwildcard
Fix #1396, #1403: Properly handle unbound wildcard types
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pending/neg/unboundWildcard.scala | 21 | ||||
-rw-r--r-- | tests/pos/wildcardInInfixType.scala | 9 |
2 files changed, 30 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) +} + |