forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#1431 from cswinter/wip-unboundwildcard
Fix scala#1396, scala#1403: Properly handle unbound wildcard types
- Loading branch information
Showing
4 changed files
with
80 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
object wildcardInInfixType { | ||
|
||
val useless: _ => _ = (x: Int) => 1 | ||
|
||
val pointless: (_ <: Int) => _ = (x: Int) => 1 | ||
|
||
val answer: Int Either _ = Left(42) | ||
} | ||
|