-
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.
Avoid embedding SelectionProtos in Conversions (#17755)
- Loading branch information
Showing
4 changed files
with
51 additions
and
6 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 |
---|---|---|
|
@@ -94,6 +94,7 @@ i4176-gadt.scala | |
|
||
# GADT difference | ||
i13974a.scala | ||
i15867.scala | ||
|
||
java-inherited-type1 | ||
|
||
|
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,19 @@ | ||
enum SUB[-A, +B]: | ||
case Refl[S]() extends SUB[S, S] | ||
|
||
class Pow(self: Int): | ||
def **(other: Int): Int = math.pow(self, other).toInt | ||
|
||
given fromList[T]: Conversion[List[T], Pow] = ??? | ||
|
||
given fromInt: Conversion[Int, Pow] = Pow(_) | ||
|
||
def foo[T](t1: T, ev: T SUB List[Int]) = | ||
ev match { case SUB.Refl() => | ||
t1 ** 2 // error | ||
} | ||
|
||
def baz[T](t2: T, ev: T SUB Int) = | ||
ev match { case SUB.Refl() => | ||
t2 ** 2 // works | ||
} |
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 @@ | ||
class Foo: | ||
given Conversion[String, Data] with | ||
def apply(str: String): Data = new Data(str) | ||
|
||
class Data(str: String): | ||
def |(str: String) = new Data(this.str + str) | ||
|
||
class Bar extends Foo: | ||
"str" | "ing" |