-
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.
Merge pull request #12549 from dotty-staging/fix-12475
- Loading branch information
Showing
13 changed files
with
173 additions
and
26 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
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,15 @@ | ||
sealed trait A | ||
|
||
enum Nums { | ||
case One | ||
case Two extends Nums with A | ||
case Three | ||
} | ||
|
||
object Test { | ||
val list = List[Nums & A](Nums.Two) | ||
|
||
list.map { | ||
case Nums.Two => () | ||
} | ||
} |
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,20 @@ | ||
sealed trait Ty { | ||
type T | ||
} | ||
|
||
class TUnit() extends Ty { | ||
type T = Unit | ||
} | ||
|
||
case object TUnit extends TUnit() | ||
|
||
final case class TFun(dom: Ty, cod: Ty) extends Ty { | ||
type T = dom.T => cod.T | ||
} | ||
|
||
def default(ty: Ty): ty.T = (ty: ty.type & Ty) match { | ||
case a: (ty.type & TUnit) => (): a.T | ||
case a: (ty.type & TFun) => | ||
val f = { (x: a.dom.T) => default(a.cod) } | ||
f: a.T | ||
} |
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,14 @@ | ||
trait SomeRestriction | ||
|
||
enum ADT { | ||
case A | ||
case B extends ADT with SomeRestriction | ||
} | ||
|
||
object MinimalExample { | ||
val b: ADT & SomeRestriction = ADT.B | ||
|
||
b match { | ||
case ADT.B => ??? | ||
} | ||
} |
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,14 @@ | ||
trait SomeRestriction | ||
|
||
enum ADT { | ||
case A extends ADT | ||
case B extends ADT with SomeRestriction | ||
} | ||
|
||
object MinimalExample { | ||
val b: ADT & SomeRestriction = ADT.B | ||
|
||
b match { | ||
case ADT.B => ??? | ||
} | ||
} |
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,2 @@ | ||
10: Match case Unreachable | ||
27: Match case Unreachable |
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,35 @@ | ||
package akka.event | ||
|
||
object TestA: | ||
sealed trait LogEvent | ||
|
||
object LogEvent: | ||
def myOrdinal(e: LogEvent): Int = e match | ||
case e: Error => 0 | ||
// case e: Warning => 1 | ||
case e: LogEventWithMarker => 2 | ||
|
||
|
||
class Error() extends LogEvent | ||
class Error2() extends Error() with LogEventWithMarker | ||
|
||
// case class Warning() extends LogEvent | ||
|
||
sealed trait LogEventWithMarker extends LogEvent | ||
|
||
object TestB: | ||
sealed trait LogEvent | ||
|
||
object LogEvent: | ||
def myOrdinal(e: LogEvent): Int = e match | ||
case e: Error => 0 | ||
case e: Warning => 1 | ||
case e: LogEventWithMarker => 2 | ||
|
||
|
||
case class Error() extends LogEvent | ||
class Error2() extends Error() with LogEventWithMarker | ||
|
||
case class Warning() extends LogEvent | ||
|
||
sealed trait LogEventWithMarker extends LogEvent |
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,2 @@ | ||
sealed class Foo[T] | ||
object Foo extends Foo[Nothing] |
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,20 @@ | ||
object Examples { | ||
|
||
case class Leaf1() extends i.Root | ||
case class Leaf2() extends i.Branch | ||
|
||
val i = new Inner() | ||
|
||
class Inner { | ||
|
||
sealed trait Root | ||
sealed trait Branch extends Root | ||
|
||
// simulate ordinal method of a Mirror.SumOf generated at this call site | ||
def myOrdinal(r: Root): Int = r match { | ||
case _: Examples.Leaf1 => 0 | ||
case _: Inner.this.Branch => 1 | ||
} | ||
} | ||
|
||
} |