-
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.
Dealias before checking for outer references in types (#16525)
Fixes #15827
- Loading branch information
Showing
3 changed files
with
61 additions
and
5 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 |
---|---|---|
|
@@ -45,6 +45,7 @@ i9999.scala | |
i6505.scala | ||
i15158.scala | ||
i15155.scala | ||
i15827.scala | ||
|
||
# Opaque type | ||
i5720.scala | ||
|
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,55 @@ | ||
|
||
trait Mirr { | ||
type MirroredTp | ||
type Elems <: Tuple | ||
} | ||
trait MirrP extends Mirr { | ||
def fromProduct(x: Product): MirroredTp | ||
} | ||
trait MirrS extends Mirr | ||
|
||
def outer3Local = { | ||
class Wrapper { | ||
object Nested { | ||
sealed trait Color | ||
} | ||
} | ||
val wrapper = new Wrapper | ||
import wrapper.Nested.Color | ||
|
||
object Inner { | ||
case object Red extends Color | ||
case object Green extends Color | ||
case object Blue extends Color | ||
case class Rgb(hex: Int) extends Color | ||
case object Rgb | ||
} | ||
|
||
object CallSite { | ||
def run = | ||
import Inner.* | ||
val M: (MirrS { type MirroredTp = Color; type Elems = (Inner.Red.type, Inner.Green.type, Inner.Blue.type, Inner.Rgb) }) = | ||
new MirrS { | ||
type MirroredTp = Color | ||
type Elems = (Inner.Red.type, Inner.Green.type, Inner.Blue.type, Inner.Rgb) | ||
} | ||
|
||
val M_Rgb = | ||
type TRgb = Tuple.Elem[M.Elems, 3] | ||
new MirrP { | ||
type MirroredTp = TRgb | ||
type Elems = Int *: EmptyTuple | ||
|
||
def fromProduct(x: Product): MirroredTp = | ||
new TRgb(x.productElement(0).asInstanceOf[Int]) | ||
}: (MirrP { | ||
type MirroredTp = TRgb | ||
type Elems = Int *: EmptyTuple | ||
}) | ||
} | ||
|
||
CallSite.run | ||
} | ||
|
||
@main def Test = | ||
outer3Local |