-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Identify structural trees on Match Type qualifiers (#18765)
- Loading branch information
Showing
3 changed files
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Ifce[BT <: Boolean]: | ||
type RT = BT match | ||
case true => this.type { val v1: Int } | ||
case false => this.type | ||
def cast: RT = this.asInstanceOf[RT] | ||
|
||
class Test: | ||
def t1: Unit = | ||
val full1 = new Ifce[true]().cast | ||
val v1 = full1.v1 // error | ||
// ^^^^^ | ||
// Found: (full1 : Ifce[(true : Boolean)]#RT) | ||
// Required: Selectable | Dynamic |
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,11 @@ | ||
class Ifce[BT <: Boolean] extends Selectable: | ||
type RT = BT match | ||
case true => this.type { val v1: Int } | ||
case false => this.type | ||
def cast : RT = this.asInstanceOf[RT] | ||
def selectDynamic(key: String): Any = ??? | ||
|
||
class Test: | ||
def t1: Unit = | ||
val full = (new Ifce[true]).cast | ||
val v1 = full.v1 |