-
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.
Fix inline proxy generation for opaque types referencing other opaque…
- Loading branch information
Showing
4 changed files
with
93 additions
and
2 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,15 @@ | ||
opaque type NT[N <: Tuple, V <: Tuple] = V | ||
opaque type System = NT[Tuple1["wires"], Tuple1[Any]] | ||
|
||
extension [N <: Tuple, V <: Tuple] (x: NT[N, V]) { | ||
inline def apply(n: Int): Any = | ||
x.productElement(n) | ||
} | ||
|
||
extension (system: System) { | ||
inline def foo = | ||
system.apply(0) | ||
} | ||
|
||
val simulation: System = ??? | ||
val _ = simulation.foo |
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,17 @@ | ||
object Obj2: | ||
opaque type NT[N <: Tuple, V <: Tuple] = V | ||
|
||
extension [N <: Tuple, V <: Tuple] (x: NT[N, V]) { | ||
inline def apply(n: Int): Any = | ||
x.productElement(n) | ||
} | ||
|
||
object Obj: | ||
opaque type System = Obj2.NT[Tuple1["wires"], Tuple1[Any]] | ||
|
||
extension (system: System) { | ||
inline def foo = system.apply(0) | ||
} | ||
import Obj._ | ||
val simulation: System = ??? | ||
val _ = simulation.foo |
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,17 @@ | ||
object Opaque: | ||
opaque type A = Int | ||
|
||
val va: A = 1 | ||
|
||
inline def a(x: A) = | ||
x + 1 | ||
|
||
object Opaque2: | ||
opaque type B = Opaque.A | ||
|
||
val vb: B = Opaque.va | ||
|
||
inline def b(x: B) = Opaque.a(x) | ||
|
||
@main def Test() = | ||
print(Opaque2.b(Opaque2.vb)) |