Skip to content

scala-xml repo has sbt console errors #313

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

Closed
ashawley opened this issue May 26, 2019 · 9 comments
Closed

scala-xml repo has sbt console errors #313

ashawley opened this issue May 26, 2019 · 9 comments

Comments

@ashawley
Copy link
Member

Seems after merging #312, starting the console in sbt causes issues:

> console
[info] Starting scala interpreter...
Welcome to Scala 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40).
Type in expressions for evaluation. Or try :help.

scala> <console>:5: error: object tools is not a member of package scala
         var value: scala.tools.nsc.interpreter.IMain = _
                          ^
<console>:6: error: object tools is not a member of package scala
         def set(x: _root_.scala.Any) = value = x.asInstanceOf[scala.tools.nsc.interpreter.IMain]

If I disable the sbt-dotty plugin, it doesn't happen.

@SethTisue
Copy link
Member

@smarter your dept, or can you recommend someone else from the Dotty team who could look at it?

@smarter
Copy link
Member

smarter commented May 26, 2019

sbt-dotty tries very carefully to not affect non-dotty projects, but turns out that we're doing it wrong and I don't know if there's a way to do it right: https://gitter.im/sbt/sbt-contrib?at=5cea7db4ad024978c62ff208. I'll look into it.

@ashawley
Copy link
Member Author

Thanks for looking into it.

These aren't fatal errors. The Scala REPL does seem to work. However the errors would seem to hint at other problems. For one, we can no longer use XML literals:

scala> <xml/>
<console>:12: error: To compile XML syntax, the scala.xml package must be on the classpath.
Please see https://github.com/scala/scala-xml for details.
       <xml/>
       ^

It seems this is because the library code is generally unreachable:

scala> scala.xml.XML.loadString("<xml/>")
<console>:12: error: object xml is not a member of package scala
       scala.xml.XML.loadString("<xml/>")

Using the JVM sub-project, xml/console will work as a workaround:

> xml/console
[info] Starting scala interpreter...
Welcome to Scala 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 11.0.2).
Type in expressions for evaluation. Or try :help.

<console>:5: error: object tools is not a member of package scala
         var value: scala.tools.nsc.interpreter.IMain = _
                          ^
<console>:6: error: object tools is not a member of package scala
         def set(x: _root_.scala.Any) = value = x.asInstanceOf[scala.tools.nsc.interpreter.IMain]
                                                                     ^
scala> <xml/>
res0: scala.xml.Elem = <xml/>

smarter added a commit to dotty-staging/dotty that referenced this issue May 28, 2019
smarter added a commit to dotty-staging/dotty that referenced this issue May 29, 2019
@smarter
Copy link
Member

smarter commented May 29, 2019

Fixed by #314.

@SethTisue
Copy link
Member

@eed3si9n maybe you should take a gander at dotty-staging/dotty@d46235b

@smarter
Copy link
Member

smarter commented May 29, 2019

@SethTisue He reviewed the PR already :)

@eed3si9n
Copy link
Member

@SethTisue Yea. Both Dale and I have reviewed scala/scala3#6577

@eed3si9n
Copy link
Member

However, I do appreciate the "hey Eugene maybe you should look at this" signals.

@SethTisue
Copy link
Member

oh sorry, I only looked at the commit without looking at the PR :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants