-
Notifications
You must be signed in to change notification settings - Fork 1.1k
java.util.NoSuchElementException: None.get
when using Compiler.newRun()
during ContextBase.initialize()
#12998
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
Comments
For reference, the line in question is a ctx without a docCtx at https://github.com/lampepfl/dotty/blob/3.0.0/compiler/src/dotty/tools/dotc/core/Definitions.scala#L1776 |
Yep, that .get should be removed and replaced by a foreach or pattern match, can you submit a PR for that @GavinRay97 ? |
Changes based on suggestion in the issue and the implementation currently seen here: https://github.com/lampepfl/dotty/blob/79fae194b80e136a243e7c7f949268166d169e1e/compiler/src/dotty/tools/dotc/typer/Namer.scala#L449
@smarter Done =) I did a codebase search for all usages of There's one case where the scenario looked nearly identical, so I used the same pattern from there: PR submitted at #13013 Unrelated: I actually managed to get this working, and in a better way than originally written! Using the Now the only problem left is that Quarkus' JUnit5 implementation doesn't seem to detect the presence of tests, in either their official Scala 2 extension or this new one for Scala 3 I've written 😦 But I'm going to try to figure that out as well, and get full Scala 3 support pushed there =) // Main.process() documentation for "dotty-interface" overload:
/** Entry point to the compiler that can be conveniently used with Java reflection.
*
* This entry point can easily be used without depending on the `dotty` package,
* you only need to depend on `dotty-interfaces` and call this method using
* reflection. This allows you to write code that will work against multiple
* versions of dotty without recompilation.
*
* The trade-off is that you can only pass a SimpleReporter to this method
* and not a normal Reporter which is more powerful.
*
* Usage example: [[https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/dotc/InterfaceEntryPointTest.scala]]
*/
class Scala3CompilationProvider extends CompilationProvider:
override def handledExtensions: util.Set[String] = Collections.singleton(".scala")
override def handledSourcePaths: util.Set[String] = super.handledSourcePaths
override def compile(files: util.Set[File], context: CompilationProvider.Context): Unit =
val sources = files.asScala.map(it => it.getAbsolutePath.toString).toList
val classpath = context.getClasspath.asScala.map(_.getAbsolutePath).mkString(File.pathSeparator)
val args = sources ++ scala.collection.immutable.List(
"-d", context.getOutputDirectory.getAbsolutePath.toString,
"-classpath", classpath,
)
val mainClass = Class.forName("dotty.tools.dotc.Main")
val process = mainClass.getMethod("process",
classOf[Array[String]], classOf[SimpleReporter], classOf[CompilerCallback])
val reporter = new CustomSimpleReporter
val callback = new CustomCompilerCallback
// Run the compiler by calling dotty.tools.dotc.Main.process
process.invoke(null, args.toArray, reporter, callback) quarkus-scala3-dev-reload.mp4 |
Changes based on suggestion in the issue and the implementation currently seen here: https://github.com/lampepfl/dotty/blob/79fae194b80e136a243e7c7f949268166d169e1e/compiler/src/dotty/tools/dotc/typer/Namer.scala#L449
…`docCtx` Changes based on suggestion in the issue and the implementation currently seen here: https://github.com/lampepfl/dotty/blob/79fae194b80e136a243e7c7f949268166d169e1e/compiler/src/dotty/tools/dotc/typer/Namer.scala#L449
Heya, sorry for the troubles, but I've been spending a good chunk of time attempting to PR support for Scala 3 to Quarkus as a newbie to both the JVM and to Scala.
I think the feature is pretty much finished, but on the actual invocation of the compiler I've hit a roadblock and I'd be grateful for any advice or direction -- googling doesn't seem to turn up much. This is the error that I get:
And the code for it this:
scala3-library_3:3.0.0
andscala-library-2.13.5
via Maven)From the logs, I can see that it picks up on the 1 changed file and everything looks okay.
I'm not really sure what is going on here 🤔
For reference in case it's useful, the current code that handles compiling Scala 2 is:
The text was updated successfully, but these errors were encountered: