Skip to content

Commit 1d4b6c0

Browse files
Merge pull request #14748 from ghostbuster91/fix/i14027
Add test to prevent i14027 regression
2 parents e7c47d6 + 21cf516 commit 1d4b6c0

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import scala.quoted.*
2+
import scala.tasty.inspector.*
3+
4+
class MyTest:
5+
List() match
6+
case Nil => 1
7+
case _ :: tail => 2
8+
9+
class TestInspector extends Inspector:
10+
override def inspect(using Quotes)(tastys: List[Tasty[quotes.type]]): Unit =
11+
import quotes.reflect.*
12+
val tree: Tree = tastys(0).ast
13+
val traverser = new TreeTraverser {}
14+
traverser.traverseTree(tree)(tree.symbol)
15+
16+
object Test {
17+
def main(args: Array[String]): Unit = {
18+
// Artefact of the current test infrastructure
19+
// TODO improve infrastructure to avoid needing this code on each test
20+
val classpath = dotty.tools.dotc.util.ClasspathFromClassloader(this.getClass.getClassLoader).split(java.io.File.pathSeparator).find(_.contains("runWithCompiler")).get
21+
val allTastyFiles = dotty.tools.io.Path(classpath).walkFilter(_.extension == "tasty").map(_.toString).toList
22+
val tastyFiles = allTastyFiles.filter(_.contains("MyTest"))
23+
24+
val inspect = new TestInspector()
25+
TastyInspector.inspectTastyFiles(allTastyFiles)(inspect)
26+
}
27+
}

0 commit comments

Comments
 (0)