-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ArrayIndexOutOfBoundsException while unpickling quote #5161
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
It can be minimized to import scala.quoted._
object Test {
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make
def main(args: Array[String]): Unit = {
val res = '{
val x: Option[Int] = Option(3)
if (x.isInstanceOf[Some[_]]) Option(1)
else None
}
println("show0 : " + res.show)
println("run1 : " + res.run)
println("run2 : " + res.run)
println("show3 : " + res.show)
}
} and fails with
It only fail if we execute a |
The issue can be workaround by upcasting the branches manually if (x.isInstanceOf[Some[_]]) Option(1)
else (None: Option[Int]) |
Are you on top off this issue @nicolasstucki or is it up for grabs? |
You can take it if you want |
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
#5297 fixes this issue |
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
The source of this error is that we create some trees in one compiler instance and use them in another. There the symbols will not coincide and hell breaks loose. #5297 fixes this by making sure the compiler instance that handles everything is in contextual scope. |
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
Changes: * Make quotes eager: fixes scala#5376 (requires context) * Fix bugs shown in scala#5429: Tree from the macro parameters is passed to another compiler to show it. * Protect against scope extrusion with early (meaningful) runtime failure (rather than in the compiler) * Add an implicit function type to provide context. * Fixes scala#5161
The main idea is to correctly keep track of the current compiler. This is paramount to support correctly `show` and quote patterns. This PR only contains the addition of the `QuoteContext` to the `run` but not the top level `$` (which will come in a second step). * Add `QuoteContext` * Define a single `Expr.show` entry point in `QuoteContext`(for `expr.show`) * Define `show(expr)` which is an alias of `run(expr.show.toExpr)` that provides a `QuoteContext` * Remove coloring options from the `Reflection.Context` and `Toolbox` settings (`show` never has colors unless a coloring format is given) * Replace `TreeCleaner` with `@quoteTypeTag` and logic in the printers * Fix scala#5161 * Regression local definitions are not renamed in quotes (postponed for future PR). See tests/run-with-compiler/quote-run-2.check.
The main idea is to correctly keep track of the current compiler. This is paramount to support correctly `show` and quote patterns. This PR only contains the addition of the `QuoteContext` to the `run` but not the top level `$` (which will come in a second step). * Add `QuoteContext` * Define a single `Expr.show` entry point in `QuoteContext`(for `expr.show`) * Define `show(expr)` which is an alias of `run(expr.show.toExpr)` that provides a `QuoteContext` * Remove coloring options from the `Reflection.Context` and `Toolbox` settings (`show` never has colors unless a coloring format is given) * Replace `TreeCleaner` with `@quoteTypeTag` and logic in the printers * Fix scala#5161 * Regression local definitions are not renamed in quotes (postponed for future PR). See tests/run-with-compiler/quote-run-2.check.
The main idea is to correctly keep track of the current compiler. This is paramount to support correctly `show` and quote patterns. This PR only contains the addition of the `QuoteContext` to the `run` but not the top level `$` (which will come in a second step). * Add `QuoteContext` * Define a single `Expr.show` entry point in `QuoteContext`(for `expr.show`) * Define `show(expr)` which is an alias of `run(expr.show.toExpr)` that provides a `QuoteContext` * Remove coloring options from the `Reflection.Context` and `Toolbox` settings (`show` never has colors unless a coloring format is given) * Replace `TreeCleaner` with `@quoteTypeTag` and logic in the printers * Fix scala#5161 * Regression local definitions are not renamed in quotes (postponed for future PR). See tests/run-with-compiler/quote-run-2.check.
Uh oh!
There was an error while loading. Please reload this page.
fails at runtime with
The text was updated successfully, but these errors were encountered: