This repository has been archived by the owner. It is now read-only.

3.0.0-M3 crashes the compiler in console #10

Open
dwijnand opened this Issue Jun 28, 2016 · 13 comments

Comments

Projects
None yet
5 participants
@dwijnand

build.properties

sbt.version=0.13.11

build.sbt

scalaVersion := "2.11.8"
addCompilerPlugin("org.scalamacros" % "paradise" % "3.0.0-M3" cross CrossVersion.full)
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.

scala> [init] error: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)

[init] error: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
null
The compiler did not initialize.
That entry seems to have slain the compiler.  Shall I replay
your session? I can re-run each line except the last one.
[y/n]Nothing to replay.

scala> 1
[init] error: error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
null
The compiler did not initialize.
That entry seems to have slain the compiler.  Shall I replay
your session? I can re-run each line except the last one.
[y/n]
Abandoning crashed session.
@xeno-by

This comment has been minimized.

Show comment
Hide comment
@xeno-by

xeno-by Jun 28, 2016

Member

What if you add scala.meta as a dependency?

Member

xeno-by commented Jun 28, 2016

What if you add scala.meta as a dependency?

@dwijnand

This comment has been minimized.

Show comment
Hide comment
@dwijnand

dwijnand Jun 28, 2016

It doesn't change the situation.

It doesn't change the situation.

dwijnand added a commit to dwijnand/dataclasses that referenced this issue Jun 30, 2016

@xeno-by

This comment has been minimized.

Show comment
Hide comment
@xeno-by

xeno-by Jun 30, 2016

Member

Here's an explanation copy/pasted from gitter:

@xeno-by 16:38
I know what’s wrong
Will fix it soon

@dwijnand is curious

@xeno-by 16:47
https://github.com/xeno-by/scalameta/blob/2ab36f552c52dfc9effb9ce1e5d9e648360b9db4/scalameta/quasiquotes/src/main/scala/scala/meta/internal/quasiquotes/ReificationMacros.scala#L296
This typeOf seems to be a problem
When you reify certain trees/types via reify/typeOf, very very weird things may happen
Option[_] carries a special symbol that represents an existentially bound type variable
And to reify it, we reify parts of the local symbol table at that location
I’ve just been describing this at a high level in my thesis, so I immediately recognized what’s wrong
The work around is not using typeOf/reify in such situations
symbolOf has exactly the same problem, because it’s based on type tags, much like typeOf

Member

xeno-by commented Jun 30, 2016

Here's an explanation copy/pasted from gitter:

@xeno-by 16:38
I know what’s wrong
Will fix it soon

@dwijnand is curious

@xeno-by 16:47
https://github.com/xeno-by/scalameta/blob/2ab36f552c52dfc9effb9ce1e5d9e648360b9db4/scalameta/quasiquotes/src/main/scala/scala/meta/internal/quasiquotes/ReificationMacros.scala#L296
This typeOf seems to be a problem
When you reify certain trees/types via reify/typeOf, very very weird things may happen
Option[_] carries a special symbol that represents an existentially bound type variable
And to reify it, we reify parts of the local symbol table at that location
I’ve just been describing this at a high level in my thesis, so I immediately recognized what’s wrong
The work around is not using typeOf/reify in such situations
symbolOf has exactly the same problem, because it’s based on type tags, much like typeOf

@dwijnand

This comment has been minimized.

Show comment
Hide comment
@dwijnand

dwijnand Jun 30, 2016

The linked fix fixes trying to splice a t"_root_.scala.Any but console/consoleQuick is still very broken..

The linked fix fixes trying to splice a t"_root_.scala.Any but console/consoleQuick is still very broken..

@xeno-by

This comment has been minimized.

Show comment
Hide comment
@xeno-by

xeno-by Jun 30, 2016

Member

Yes indeed it is. That's why the commit message says "attempt to fix". Tsk tsk tsk, Github.

Member

xeno-by commented Jun 30, 2016

Yes indeed it is. That's why the commit message says "attempt to fix". Tsk tsk tsk, Github.

@dwijnand

This comment has been minimized.

Show comment
Hide comment
@dwijnand

dwijnand Jul 1, 2016

C'mon GitHub...

dwijnand commented Jul 1, 2016

C'mon GitHub...

@dwijnand

This comment has been minimized.

Show comment
Hide comment
@dwijnand

dwijnand Jul 1, 2016

@xeno-by re-open please

dwijnand commented Jul 1, 2016

@xeno-by re-open please

@xeno-by xeno-by reopened this Jul 1, 2016

olafurpg added a commit to olafurpg/scalameta that referenced this issue Oct 12, 2016

attempt to fix scalameta/paradise#10
typeOf/symbolOf/hygienicRef for existential types have been replaced
with equivalent constructs that don't involve reification. To see why
that's necessary, refer to the aforementioned issue.

I don't like the fact that I can't test this in an automated fashion
(well, at least I can't come up with a way of doing that at the moment).
@xeno-by

This comment has been minimized.

Show comment
Hide comment
@xeno-by

xeno-by Nov 6, 2016

Member

More information about this issue can be found in #117.

Member

xeno-by commented Nov 6, 2016

More information about this issue can be found in #117.

olafurpg referenced this issue in xeno-by/new-tutorial Nov 7, 2016

import from https://github.com/olafurpg/scala.meta-workshop
Changes from the original version:

* compileTimeOnly is removed. If we compile a macro annotation with paradise,
this annotation will be added automatically. If we don’t compile with paradise,
the compilation will fail.

* The example macro annotation is moved to the default package.
Neither IntelliJ, nor Dotty support macro annotations coming from named packages.

* The build is simplified and reorganized to explain its individual pieces.
Not sure why we needed `sources in (Compile, doc) := Nil`.

* Meta and paradise versions are now hardcoded without any explanation.
These magic string will be updated by our CI. I found that even with
the previously present explanations it is too hard for newcomers
to figure out correct versions.

* A brief explanation of new-style macros and environment setup is added.
@marcintustin

This comment has been minimized.

Show comment
Hide comment
@marcintustin

marcintustin Dec 27, 2016

I still have this issue with 3.0.0-beta4

I still have this issue with 3.0.0-beta4

@marcintustin

This comment has been minimized.

Show comment
Hide comment
@marcintustin

marcintustin Dec 27, 2016

Incidentally, this workaround doesn't help me, because I need the compiler plugin to compile my code: scalameta/sbt-macro-example@3f5c1e2

Incidentally, this workaround doesn't help me, because I need the compiler plugin to compile my code: scalameta/sbt-macro-example@3f5c1e2

@soronpo

This comment has been minimized.

Show comment
Hide comment
@soronpo

soronpo Jun 20, 2017

With help from @dwijnand, a better work-around than scalacOptions in (Compile, console) := Seq() is

scalacOptions in (Compile, console) ~= (_ filterNot (_ contains "paradise"))

This removes the paradise option and plug-in jars, and leaves the rest of the REPL options intact.
I recommend updating the tutorial with this line.

soronpo commented Jun 20, 2017

With help from @dwijnand, a better work-around than scalacOptions in (Compile, console) := Seq() is

scalacOptions in (Compile, console) ~= (_ filterNot (_ contains "paradise"))

This removes the paradise option and plug-in jars, and leaves the rest of the REPL options intact.
I recommend updating the tutorial with this line.

@soronpo

This comment has been minimized.

Show comment
Hide comment
@soronpo

soronpo Jun 20, 2017

Created PR for the tutorial with the updated work-around
scalameta/tutorial#24

soronpo commented Jun 20, 2017

Created PR for the tutorial with the updated work-around
scalameta/tutorial#24

@fommil

This comment has been minimized.

Show comment
Hide comment
@fommil

fommil Jul 16, 2017

probably related to #212 since it's again to do with loading itself into the compiler phases.

fommil commented Jul 16, 2017

probably related to #212 since it's again to do with loading itself into the compiler phases.

@dominv dominv referenced this issue in frees-io/freestyle Jul 20, 2017

Closed

Problems with Kazari #185

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.