-
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 #14284 from dotty-staging/fix-#14282
Properly desugar `inline given .. with ..`
- Loading branch information
Showing
7 changed files
with
76 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import scala.compiletime.* | ||
|
||
trait C[A] | ||
|
||
inline given [Tup <: Tuple]: C[Tup] with | ||
val cs = summonAll[Tuple.Map[Tup, C]] // error cannot reduce inline match with |
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 @@ | ||
class T | ||
|
||
transparent inline given fail1: T with // error | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
transparent inline given fail2[X]: T with // error | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
transparent inline given fail3(using DummyImplicit): T with // error | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
|
||
transparent inline given ok1: T = new T: | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
transparent inline given ok2[X]: T = new T: | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
transparent inline given ok3(using DummyImplicit): T = new T: | ||
val cs = scala.compiletime.summonAll[EmptyTuple] |
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 @@ | ||
class T | ||
|
||
inline given fail1: T with | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
inline given fail2[X]: T with | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
inline given fail3(using DummyImplicit): T with | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
|
||
inline given ok1: T = new T: | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
inline given ok2[X]: T = new T: | ||
val cs = scala.compiletime.summonAll[EmptyTuple] | ||
inline given ok3(using DummyImplicit): T = new T: | ||
val cs = scala.compiletime.summonAll[EmptyTuple] |
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 @@ | ||
trait Foo[A] { | ||
inline def foo(): Unit | ||
} | ||
|
||
inline given FooA[A]: Foo[A] with { | ||
inline def foo(): Unit = println() | ||
} | ||
def test1 = FooA.foo() | ||
|
||
inline given FooInt: Foo[Int] with { | ||
inline def foo(): Unit = println() | ||
} | ||
def test2 = FooInt.foo() |