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.
Merge pull request scala#3143 from dotty-staging/ycheck-patterns
Update ReTyper to Ycheck patterns & inline fixes
- Loading branch information
Showing
13 changed files
with
96 additions
and
19 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
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,14 @@ | ||
object Test { | ||
implicit class Foo(sc: StringContext) { | ||
object q { | ||
inline def unapply(arg: Any): Option[(Any, Any)] = | ||
Some((sc.parts(0), sc.parts(1))) | ||
} | ||
} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val q"class $name extends $parent" = new Object | ||
println(name) | ||
println(parent) | ||
} | ||
} |
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,4 @@ | ||
object Test { | ||
inline def sum2(ys: List[Int]): Int = (1 /: ys)(_ + _) | ||
val h1: ((List[Int]) => Int) = sum2 | ||
} |
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,5 @@ | ||
object t1 { | ||
inline def construct[Elem, Coll[_]](xs: List[Elem]): Coll[Elem] = ??? | ||
|
||
val xs3 = construct[Coll = List](List(1, 2, 3)) | ||
} |
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,8 @@ | ||
object Test extends App { | ||
inline def foo[T](bar: T) = { | ||
bar match { | ||
case _ => () | ||
} | ||
} | ||
foo(Array(1, 2)) | ||
} |
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,11 @@ | ||
final class Foo(val value: Int) | ||
|
||
object Foo { | ||
inline def unapply(foo: Foo): Some[Int] = Some(foo.value) | ||
} | ||
|
||
object Test { | ||
def transformTree(f: Foo): Any = f match { | ||
case 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,23 @@ | ||
final class Foo(val value: Int) | ||
|
||
object Foo { | ||
inline def unapplySeq(foo: Foo): Some[Seq[Int]] = Some(List(foo.value)) | ||
} | ||
|
||
sealed trait Tree | ||
case class Node1(foo: Foo) extends Tree | ||
case class Node2() extends Tree | ||
|
||
object Test { | ||
def transformTree(tree: Tree): Any = tree match { | ||
case Node1(Foo(_: _*)) => ??? | ||
} | ||
|
||
def transformTree2(tree: Tree): Any = tree match { | ||
case Node1(Foo(1, _: _*)) => ??? | ||
} | ||
|
||
def transformTree3(tree: Tree): Any = tree match { | ||
case Node1(Foo(x, _: _*)) => ??? | ||
} | ||
} |