-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update ReTyper to Ycheck patterns & inline fixes #3143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ca58eaa
cec6307
a89407c
e9837a2
11b3e2c
30097fe
954e080
a506b50
66874ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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) | ||
} | ||
} |
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 | ||
} |
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)) | ||
} |
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)) | ||
} |
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(_) => ??? | ||
} | ||
} |
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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be changed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say not for now, if/when |
||
} | ||
|
||
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, _: _*)) => ??? | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the change. Can you give an example where this matters?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test added in the same commit (e199fc8) breaks with a match error before the change
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be much more efficient to implement this methods as: