-
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.
Add test cases project for presentation compiler (#22101)
This PR adds a mechanism to test the presentation compiler with snippets using arbitrary pre-compiled files. To do so, it adds a new project `scala3-presentation-compiler-testcases`, compiled with the bootstrapped compiler, which is used as a dependency of `scala3-presentation-compiler`. The resulting class path is added to the `ideTestsDependencyClasspath` build info so that the test cases can be used from the presentation compiler tests. This PR also adds a test case for #20560. It shows that there is no hover info for the resulting type of a `transparent inline` macro when it fails to execute. However, the macro succeeds when loading the class `java.sql.Driver`, so that still doesn't tell us what the problem is with #20560…
- Loading branch information
Showing
5 changed files
with
43 additions
and
6 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
16 changes: 16 additions & 0 deletions
16
presentation-compiler-testcases/src/tests/macros/20560.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package tests.macros | ||
|
||
import scala.quoted.{Expr, Quotes} | ||
|
||
object Macro20560: | ||
transparent inline def loadJavaSqlDriver: Int = ${ loadJavaSqlDriverImpl } | ||
|
||
private def loadJavaSqlDriverImpl(using Quotes): Expr[42] = | ||
Class.forName("java.sql.Driver") | ||
'{42} | ||
|
||
transparent inline def loadJavaSqlInexisting: Int = ${ loadJavaSqlInexistingImpl } | ||
|
||
private def loadJavaSqlInexistingImpl(using Quotes): Expr[42] = | ||
Class.forName("java.sql.Inexisting") | ||
'{42} |
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