-
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.
Simplify macro tests with custom args
[Cherry-picked cc90bf3][modified]
- Loading branch information
Showing
51 changed files
with
125 additions
and
24 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// scalac: -Xfatal-warnings | ||
|
||
import scala.quoted.* | ||
|
||
object Macros { | ||
|
2 changes: 2 additions & 0 deletions
2
tests/pos-macros/macro-deprecation.scala → tests/neg-macros/macro-deprecation.scala
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,3 +1,5 @@ | ||
// scalac: -Xfatal-warnings -deprecation | ||
|
||
import scala.quoted.* | ||
|
||
inline def f = ${ impl } // error | ||
|
2 changes: 2 additions & 0 deletions
2
tests/pos-macros/macro-experimental.scala → tests/neg-macros/macro-experimental.scala
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,3 +1,5 @@ | ||
// scalac: -Yno-experimental | ||
|
||
import scala.quoted.* | ||
import scala.annotation.experimental | ||
|
||
|
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,9 @@ | ||
-- [E008] Not Found Error: tests/neg/i9685bis.scala:25:4 --------------------------------------------------------------- | ||
25 | 1.asdf // error | ||
| ^^^^^^ | ||
| value asdf is not a member of Int, but could be made available as an extension method. | ||
| | ||
| The following import might make progress towards fixing the problem: | ||
| | ||
| import foo.Baz.toBaz | ||
| |
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,25 @@ | ||
// scalac: -source future | ||
|
||
package foo | ||
|
||
import scala.language.implicitConversions | ||
|
||
class Foo | ||
|
||
object Foo: | ||
|
||
inline implicit def toFoo(x: Int): Foo = Foo() | ||
|
||
class Bar | ||
|
||
object Bar: | ||
inline given Conversion[Int, Bar] with | ||
def apply(x: Int): Bar = Bar() | ||
|
||
class Baz | ||
|
||
object Baz: | ||
transparent inline implicit def toBaz(x: Int): Baz = Baz() | ||
|
||
object Usage: | ||
1.asdf // error |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
// scalac: -Xfatal-warnings | ||
|
||
@main def main: Unit = hh() |
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
tests/pos-special/i7592/Test_2.scala → tests/pos-macros/i7592/Test_2.scala
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,3 +1,5 @@ | ||
// scalac: -Yretain-trees | ||
|
||
def return1 = 1 | ||
|
||
def testReturn1 = { | ||
|
1 change: 1 addition & 0 deletions
1
...rgs/semanticdb/inline-unapply/App_2.scala → ...ros/semanticdb-inline-unapply/App_2.scala
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,3 +1,4 @@ | ||
// scalac: -Xsemanticdb | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
|
2 changes: 2 additions & 0 deletions
2
...s/semanticdb/inline-unapply/Macro_1.scala → ...s/semanticdb-inline-unapply/Macro_1.scala
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,3 +1,5 @@ | ||
// scalac: -Xsemanticdb | ||
|
||
import scala.quoted.* | ||
|
||
object Succ: | ||
|
2 changes: 2 additions & 0 deletions
2
...args/semanticdb/macro-pos/example_1.scala → ...cros/semanticdb-macro-pos/example_1.scala
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,3 +1,5 @@ | ||
// scalac: -Xsemanticdb | ||
|
||
import quoted.* | ||
|
||
object CodeImpl { | ||
|
2 changes: 2 additions & 0 deletions
2
...args/semanticdb/macro-pos/example_2.scala → ...cros/semanticdb-macro-pos/example_2.scala
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,3 +1,5 @@ | ||
// scalac: -Xsemanticdb | ||
|
||
import quoted.* | ||
|
||
object TestImpl { | ||
|
2 changes: 2 additions & 0 deletions
2
...args/semanticdb/macro-pos/example_3.scala → ...cros/semanticdb-macro-pos/example_3.scala
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,3 +1,5 @@ | ||
// scalac: -Xsemanticdb | ||
|
||
object Test { | ||
|
||
def test = TestImpl.fun("") | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...om-args/Xmacro-settings/simple/Test.scala → ...-macros/Xmacro-settings-simple/Test.scala
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,3 +1,5 @@ | ||
// scalac: -Xmacro-settings:one,two,three | ||
|
||
import x.* | ||
|
||
object Test { | ||
|
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...m-args/Yread-comments/i12351/Test_2.scala → tests/run-macros/i12351/Test_2.scala
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
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...tom-args/Yread-comments/i12352/Main.scala → tests/run-macros/i12352/Main.scala
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,3 +1,5 @@ | ||
// scalac: -Yread-docs | ||
|
||
@main def Test(): Unit = { | ||
val res = getDocString[scala.quoted.Quotes] | ||
println(res) | ||
|
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,3 @@ | ||
case erased: [erased case] | ||
case erased nested: c | ||
case erased nested 2: d |
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,27 @@ | ||
import scala.language.experimental.erasedDefinitions | ||
|
||
import scala.quoted.* | ||
|
||
inline def testExpr(inline body: Any) = ${ testExprImpl('body) } | ||
def testExprImpl(body: Expr[Any])(using Quotes): Expr[String] = | ||
body match | ||
// Erased Types | ||
case '{ def erasedfn(y: String) = "placeholder"; $a(erasedfn): String } => | ||
Expr("This case should not match") | ||
case '{ def erasedfn(erased y: String) = "placeholder"; $a(erasedfn): String } => | ||
'{ $a((erased z: String) => "[erased case]") } | ||
case '{ | ||
def erasedfn(a: String, b: String)(c: String, d: String): String = a | ||
$y(erasedfn): String | ||
} => Expr("This should not match") | ||
case '{ | ||
def erasedfn(a: String, erased b: String)(erased c: String, d: String): String = a | ||
$y(erasedfn): String | ||
} => | ||
'{ $y((a: String, erased b: String) => (erased c: String, d: String) => d) } | ||
case '{ | ||
def erasedfn(a: String, erased b: String)(c: String, erased d: String): String = a | ||
$y(erasedfn): String | ||
} => | ||
'{ $y((a: String, erased b: String) => (c: String, erased d: String) => c) } | ||
case _ => Expr("not matched") |
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,12 @@ | ||
import scala.language.experimental.erasedDefinitions | ||
|
||
@main def Test: Unit = | ||
println("case erased: " + testExpr { def erasedfn1(erased x: String) = "placeholder"; erasedfn1("arg1")}) | ||
println("case erased nested: " + testExpr { | ||
def erasedfn2(p: String, erased q: String)(r: String, erased s: String) = p | ||
erasedfn2("a", "b")("c", "d") | ||
}) | ||
println("case erased nested 2: " + testExpr { | ||
def erasedfn2(p: String, erased q: String)(erased r: String, s: String) = p | ||
erasedfn2("a", "b")("c", "d") | ||
}) |
2 changes: 2 additions & 0 deletions
2
...gs/run-macros-erased/macro-erased/1.scala → tests/run-macros/macro-erased/Macro_1.scala
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,3 +1,5 @@ | ||
import scala.language.experimental.erasedDefinitions | ||
|
||
import scala.quoted.* | ||
|
||
object Macro { | ||
|
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...rased/reflect-isFunctionType/test_2.scala → ...acros/reflect-isFunctionType/test_2.scala
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,3 +1,5 @@ | ||
import scala.language.experimental.erasedDefinitions | ||
|
||
trait Box { | ||
type T | ||
} | ||
|
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,3 +1,4 @@ | ||
// scalac: -Yretain-trees | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
|
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...in-trees/tasty-definitions-2/Test_2.scala → ...n-macros/tasty-definitions-2/Test_2.scala
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
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...in-trees/tasty-definitions-3/Test_2.scala → ...n-macros/tasty-definitions-3/Test_2.scala
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,3 +1,5 @@ | ||
// scalac: -Yretain-trees | ||
|
||
object Test { | ||
|
||
def main(args: Array[String]): Unit = { | ||
|
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...es/tasty-extractors-owners/quoted_2.scala → ...os/tasty-extractors-owners/quoted_2.scala
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,3 +1,4 @@ | ||
// scalac: -Yretain-trees | ||
|
||
import Macros.* | ||
|
||
|
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...in-trees/tasty-load-tree-1/quoted_2.scala → ...n-macros/tasty-load-tree-1/quoted_2.scala
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,3 +1,4 @@ | ||
// scalac: -Yretain-trees | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
|
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...in-trees/tasty-load-tree-2/quoted_2.scala → ...n-macros/tasty-load-tree-2/quoted_2.scala
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,3 +1,4 @@ | ||
// scalac: -Yretain-trees | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
|