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
Presentation compiler / typer crash on Scala-IDE unit test #7362
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7362?orig=1
|
@huitseeker said (edited on Apr 12, 2013 12:44:56 PM UTC): |
@dragos said: |
@huitseeker said: |
@paulp said: I freely admit I don't have a clue how the setError etc. code is supposed to work, which is a big problem. That patch was to fix #6340, which was also a big problem. If I revert that one-line change, your files/test/presentation/t1207 test goes from crashing to producing this:
which I assume is the correct output, the checkfile is empty. |
@paulp said: % scalac -Xprint-pos -Xprint:all -Yshow-trees -d /tmp test/files/presentation/t1207/src/Completions.scala before and after reverting a2c870569c124c. @@ -130,7 +130,12 @@ import java.uti /*!*/
[[syntax trees at end of typer]]// Scala source: Completions.scala
PackageDef(
[8]"ticket_1001207" // final package ticket_1001207, tree.tpe=ticket_1001207.type
- <empty>
+ [31]Import( // val <import>: ImportType([31]java)
+ [31]"java" // final package java, tree.tpe=java.type
+ List(
+ ImportSelector(uti,36,uti,36)
+ )
+ )
[53]ClassDef( // class T1207 extends AnyRef in package ticket_1001207
0
"T1207" |
@retronym said: I believe something like the following is needed. diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index dbdb2d0..a5e6d47 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -1036,10 +1036,12 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
private def typeMembers(pos: Position): Stream[List[TypeMember]] = {
var tree = typedTreeAt(pos)
- // if tree consists of just x. or x.fo where fo is not yet a full member name
- // ignore the selection and look in just x.
tree match {
+ // if tree consists of just x. or x.fo where fo is not yet a full member name
+ // ignore the selection and look in just x.
case Select(qual, name) if tree.tpe == ErrorType => tree = qual
+ // Similarly, for import x. or x.fo
+ case Import(expr, sels) => tree = expr
case _ =>
} What are the expected results from these cases? import java./*!*/
import java.u/*!*/
import java.util/*!*/
import java.{lang, u/*!*/}
import j/*!*/ With the patch, for the first four, we get:
The last one is perhaps a separate problem. |
@paulp said: |
@paulp said: |
@retronym said: |
As shown by bisection, commit 9094822 introduced a regression in a presentation compiler test on the IDE side : T1207 checking for completion method plumbing (original issue : #1001207).
Edit : there's a much simpler test case available [below as a Scala PC test|https://issues.scala-lang.org/browse/SI-7362?focusedCommentId=63660&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-63660].
The test tries to generate a completion on a Scala source containing a java package name (at the point containing an exclamation mark).
The failure manifests by returning an empty completion list (instead of the expected java package name):
The detailed output a problem in typers that makes the completion details appear coincidental :
Compile the scala commit (9094822 or posterior) on which you have cherry-picked an sbt version update. Compile sbt 0.13 off of that, and a 2.11-compatible version of Scala-IDE on top of the previous two.
As far as 2-11-compatible means : I'll keep the minimal tweaks needed for Scala-IDE compilation off of 2.11 on my branch build-script-tweaks.
If this whole process sounds too complicated, you may want to try [my bash script|http://quatramaran.ens.fr/~garillot/tmp/bisect.sh] to do that (don't mind the bisect name). It just assumes scala,sbinary,sbt,scala-refactoring, scala-ide checkouts present on your system (directory names configured at the beginning of the script), and does the whole scala -> sbinary -> sbt -> scala-refactoring -> scala-ide compile based on a non-polluting use of your maven local repo and whatever you have present in said directories. Ping me if you need help using it.
The text was updated successfully, but these errors were encountered: