-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Presentation Compiler is now loaded with correct Classloader
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
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
56 changes: 56 additions & 0 deletions
56
tests/unit/src/test/scala/tests/ClassloaderModulesSupport.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,56 @@ | ||
package tests | ||
|
||
import scala.meta.internal.metals.BuildInfo | ||
|
||
class ClassloaderModulesSupport | ||
extends BaseLspSuite("classloader-modules-") | ||
with TestHovers { | ||
|
||
test("basic") { | ||
cleanWorkspace() | ||
for { | ||
_ <- initialize( | ||
s"""/metals.json | ||
|{ | ||
| "a": { "scalaVersion": "${BuildInfo.scala3}" }, | ||
| "b": { "dependsOn": ["a"], "scalaVersion": "${BuildInfo.scala3}" } | ||
|} | ||
| | ||
|/a/src/main/scala/a/A.scala | ||
|package a | ||
| | ||
|import scala.quoted._ | ||
| | ||
|object MacroImpl: | ||
| transparent inline def make = $${ makeImpl } | ||
| | ||
| private def makeImpl(using Quotes): Expr[Unit] = | ||
| Class.forName("java.sql.Driver") | ||
| '{()} | ||
| | ||
|/b/src/main/scala/b/B.scala | ||
|package b | ||
| | ||
|object B: | ||
| a.MacroImpl.make | ||
|""".stripMargin | ||
) | ||
_ <- server.didOpen("a/src/main/scala/a/A.scala") | ||
_ <- server.didOpen("b/src/main/scala/b/B.scala") | ||
_ = assertNoDiagnostics() | ||
_ <- server.assertHover( | ||
"b/src/main/scala/b/B.scala", | ||
""" | ||
|/b/src/main/scala/b/B.scala | ||
|package b | ||
| | ||
|object B: | ||
| a.MacroImpl.ma@@ke | ||
|""".stripMargin, | ||
"""| | ||
|inline transparent def make: Unit | ||
|""".stripMargin.hover, | ||
) | ||
} yield () | ||
} | ||
} |