forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
25 additions
and
14 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 was deleted.
Oops, something went wrong.
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,23 @@ | ||
import scala.reflect.TypeTest | ||
|
||
class ForSyntax[E](using E: TypeTest[E | Any, E]): | ||
extension [A](aOrE: E | A) | ||
inline def flatMap[B](f: A => E | B): E | B = | ||
aOrE match | ||
case e: E => ??? | ||
case _ => ??? | ||
|
||
|
||
class UnhappyCase[E](using E: TypeTest[E | Any, E]) extends ForSyntax[E]: | ||
extension [A](aOrE: E | A) | ||
inline def fold[B](inline fe: E => B, inline fa: A => B): B = | ||
aOrE match | ||
case e: E => ??? | ||
case _ => ??? | ||
|
||
class A: | ||
private val a = 1 | ||
inline def foo() = a | ||
class B extends A: | ||
private val a = 2 | ||
inline def bar() = a |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Select(Typed(Apply(Select(New(TypeIdent("StringContextOps")), "<init>"), List(Apply(Select(Select(Select(Ident("_root_"), "scala"), "StringContext"), "apply"), List(Typed(Repeated(List(Literal(StringConstant("Hello World ")), Literal(StringConstant("!"))), Inferred()), Inferred()))))), TypeIdent("StringContextOps")), "inline$sc") | ||
Select(Typed(Apply(Select(New(TypeIdent("StringContextOps")), "<init>"), List(Apply(Select(Select(Select(Ident("_root_"), "scala"), "StringContext"), "apply"), List(Typed(Repeated(List(Literal(StringConstant("Hello World ")), Literal(StringConstant("!"))), Inferred()), Inferred()))))), TypeIdent("StringContextOps")), "Macro$StringContextOps$$inline$sc") | ||
Typed(Repeated(List(Literal(IntConstant(1))), Inferred()), Inferred()) |