Skip to content
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

ClassHierarchy branch errors resolving variables. #47

Closed
as3boyan opened this issue Nov 3, 2014 · 16 comments
Closed

ClassHierarchy branch errors resolving variables. #47

as3boyan opened this issue Nov 3, 2014 · 16 comments
Assignees
Labels

Comments

@as3boyan
Copy link
Contributor

as3boyan commented Nov 3, 2014

ClassHierarchy has broken variables resolving

Even simple

var z:Int;
z = 1; //marked as unresolved
@as3boyan
Copy link
Contributor Author

as3boyan commented Nov 3, 2014

JetBrains branch doesn't have such problems. I think this should be related to PSI changes you guys made.

@EBatTiVo
Copy link
Contributor

EBatTiVo commented Nov 3, 2014

OK. I'll take a look.

@grisevg
Copy link

grisevg commented Nov 4, 2014

Also there is an error if there are two @:access in a row.
Example:

@:access(openfl.display.Graphics)
@:access(openfl.text.TextFormat)
class TextField extends InteractiveObject {

It works fine in JetBrains branch, but errors out with ',', <extern or private> or enum expected, got '@:access' in this jar: https://github.com/EBatTiVo/intellij-haxe/blob/a66aba37f1d4f6be2c25d2e3d896547e03fabbac/intellij-haxe.jar

@EBatTiVo
Copy link
Contributor

EBatTiVo commented Nov 4, 2014

grisevg wrote:

Also there is an error if ...

Opened a new issue #48.

@EBatTiVo EBatTiVo changed the title ClassHierarchy branch issues ClassHierarchy branch errors resolving variables. Nov 5, 2014
@EBatTiVo
Copy link
Contributor

EBatTiVo commented Nov 6, 2014

TiVo Internal Reference: STB-5073

@EBatTiVo EBatTiVo self-assigned this Nov 6, 2014
@EBatTiVo EBatTiVo added the bug label Nov 6, 2014
@as3boyan
Copy link
Contributor Author

[  15052]  ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 13.1.5  Build #IU-135.1289 
[  15052]  ERROR - aemon.impl.PassExecutorService - JDK: 1.6.0_38-ea 
[  15052]  ERROR - aemon.impl.PassExecutorService - VM: Java HotSpot(TM) 64-Bit Server VM 
[  15052]  ERROR - aemon.impl.PassExecutorService - Vendor: Sun Microsystems Inc. 
[  15052]  ERROR - aemon.impl.PassExecutorService - OS: Linux 
[  15052]  ERROR - aemon.impl.PassExecutorService - Last Action:  
[  15052]  ERROR - aemon.impl.PassExecutorService - null 
java.lang.NullPointerException
    at com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodPsiMixinImpl.isPrivate(HaxeMethodPsiMixinImpl.java:289)
    at com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodPsiMixinImpl.isPublic(HaxeMethodPsiMixinImpl.java:300)
    at com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodPsiMixinImpl.getModifierList(HaxeMethodPsiMixinImpl.java:339)
    at com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodPsiMixinImpl.getModifierList(HaxeMethodPsiMixinImpl.java:45)
    at com.intellij.codeInsight.AnnotationUtil.findAnnotation(AnnotationUtil.java:106)
    at com.intellij.codeInsight.AnnotationUtil.findAnnotation(AnnotationUtil.java:89)
    at com.intellij.codeInsight.AnnotationUtil.findAnnotation(AnnotationUtil.java:82)
    at com.intellij.codeInspection.JavaSuppressionUtil.getAnnotationMemberSuppressedIn(JavaSuppressionUtil.java:128)
    at com.intellij.codeInspection.JavaSuppressionUtil.getElementMemberSuppressedIn(JavaSuppressionUtil.java:112)
    at com.intellij.codeInspection.JavaSuppressionUtil$1.compute(JavaSuppressionUtil.java:221)
    at com.intellij.codeInspection.JavaSuppressionUtil$1.compute(JavaSuppressionUtil.java:199)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:921)
    at com.intellij.codeInspection.JavaSuppressionUtil.getElementToolSuppressedIn(JavaSuppressionUtil.java:199)
    at com.intellij.codeInspection.BatchSuppressManagerImpl.isSuppressedFor(BatchSuppressManagerImpl.java:45)
    at com.intellij.codeInspection.BaseJavaBatchLocalInspectionTool.isSuppressedFor(BaseJavaBatchLocalInspectionTool.java:45)
    at com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase.isSuppressedFor(UnusedSymbolLocalInspectionBase.java:42)
    at com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase.isSuppressedFor(UnusedSymbolLocalInspectionBase.java:39)
    at com.intellij.codeInspection.SuppressionUtil.inspectionResultSuppressed(SuppressionUtil.java:198)
    at com.intellij.codeInsight.daemon.impl.PostHighlightingPass.a(PostHighlightingPass.java:271)
    at com.intellij.codeInsight.daemon.impl.PostHighlightingPass.a(PostHighlightingPass.java:237)
    at com.intellij.codeInsight.daemon.impl.PostHighlightingPass.access$000(PostHighlightingPass.java:77)
    at com.intellij.codeInsight.daemon.impl.PostHighlightingPass$1.run(PostHighlightingPass.java:152)
    at com.intellij.codeInsight.daemon.impl.RefCountHolder.retrieveUnusedReferencesInfo(RefCountHolder.java:346)
    at com.intellij.codeInsight.daemon.impl.PostHighlightingPass.collectInformationWithProgress(PostHighlightingPass.java:149)
    at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:86)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:62)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:380)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1154)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:371)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:368)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:344)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask.exec(JobLauncherImpl.java:193)
    at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858)
    at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687)
    at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642)
    at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:109)
[  15052]  ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 13.1.5  Build #IU-135.1289 
[  15052]  ERROR - aemon.impl.PassExecutorService - JDK: 1.6.0_38-ea 
[  15052]  ERROR - aemon.impl.PassExecutorService - VM: Java HotSpot(TM) 64-Bit Server VM 
[  15052]  ERROR - aemon.impl.PassExecutorService - Vendor: Sun Microsystems Inc. 
[  15052]  ERROR - aemon.impl.PassExecutorService - OS: Linux 
[  15052]  ERROR - aemon.impl.PassExecutorService - Last Action:  

@as3boyan
Copy link
Contributor Author

When I type something following error occurs together with mentioned above one:

[  99041]  ERROR - tellij.psi.impl.PsiElementBase - IntelliJ IDEA 13.1.5  Build #IU-135.1289 
[  99041]  ERROR - tellij.psi.impl.PsiElementBase - JDK: 1.6.0_38-ea 
[  99041]  ERROR - tellij.psi.impl.PsiElementBase - VM: Java HotSpot(TM) 64-Bit Server VM 
[  99041]  ERROR - tellij.psi.impl.PsiElementBase - Vendor: Sun Microsystems Inc. 
[  99041]  ERROR - tellij.psi.impl.PsiElementBase - OS: Linux 
[  99041]  ERROR - tellij.psi.impl.PsiElementBase - Last Action: EditorDeleteToWordStart 
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - @NotNull method com/intellij/psi/impl/PsiElementBase.notNullChild must not return null 
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:113)
    at com.intellij.plugins.haxe.lang.psi.impl.HaxeNamedElementImpl.getName(HaxeNamedElementImpl.java:76)
    at com.intellij.plugins.haxe.ide.HaxeLookupElement.getLookupString(HaxeLookupElement.java:52)
    at com.intellij.codeInsight.lookup.LookupElement.getAllLookupStrings(LookupElement.java:45)
    at com.intellij.codeInsight.completion.impl.CamelHumpMatcher.a(CamelHumpMatcher.java:73)
    at com.intellij.codeInsight.completion.impl.CamelHumpMatcher.prefixMatches(CamelHumpMatcher.java:69)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor$1.consume(LegacyCompletionContributor.java:75)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor$1.consume(LegacyCompletionContributor.java:68)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.a(LegacyCompletionContributor.java:123)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.processReferences(LegacyCompletionContributor.java:106)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.completeReference(LegacyCompletionContributor.java:68)
    at com.intellij.codeInsight.completion.LegacyCompletionContributor.fillCompletionVariants(LegacyCompletionContributor.java:51)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
    at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
    at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:75)
    at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
    at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
    at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:84)
    at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:115)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:769)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$900(CompletionProgressIndicator.java:84)
    at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:751)
    at com.intellij.codeInsight.completion.AsyncCompletion$1$1$1.run(CompletionThreading.java:93)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:911)
    at com.intellij.codeInsight.completion.AsyncCompletion$1$1.run(CompletionThreading.java:88)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at com.intellij.codeInsight.completion.AsyncCompletion$1.run(CompletionThreading.java:84)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - IntelliJ IDEA 13.1.5  Build #IU-135.1289 
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - JDK: 1.6.0_38-ea 
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - VM: Java HotSpot(TM) 64-Bit Server VM 
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - Vendor: Sun Microsystems Inc. 
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - OS: Linux 
[  99042]  ERROR - .psi.impl.HaxeNamedElementImpl - Last Action: EditorDeleteToWordStart 
[ 100610]  ERROR - n.impl.GeneralHighlightingPass - null 
java.lang.NullPointerException
[ 100612]  ERROR - n.impl.GeneralHighlightingPass - IntelliJ IDEA 13.1.5  Build #IU-135.1289 
[ 100612]  ERROR - n.impl.GeneralHighlightingPass - JDK: 1.6.0_38-ea 
[ 100612]  ERROR - n.impl.GeneralHighlightingPass - VM: Java HotSpot(TM) 64-Bit Server VM 
[ 100612]  ERROR - n.impl.GeneralHighlightingPass - Vendor: Sun Microsystems Inc. 
[ 100612]  ERROR - n.impl.GeneralHighlightingPass - OS: Linux 
[ 100612]  ERROR - n.impl.GeneralHighlightingPass - Last Action: EditorEscape 
[ 100822]  ERROR - aemon.impl.PassExecutorService - null 

@as3boyan
Copy link
Contributor Author

Also it seems like unit tests need to be updated too.

@EBatTiVo
Copy link
Contributor

<> Unit Tests? What are those? <>

Actually, I haven't run them. (I've been in such a hurry to get stuff working.) It's a good idea to keep them up to date. I'll check them and make sure they work when I figure this out.

As far as the exceptions go, I thought I fixed the one in HaxeMethodPsiMixinImpl.isPrivate(). I've seen it before. I'm fully synched up, so it must be a different path to the same problem.

@as3boyan
Copy link
Contributor Author

Yeah, it's Haxe Tests in targets dropdown list. A lot of them fail, but that due some changes to PSI, basically it's pretty close.

Great. I will test. Previously I was getting some errors related to HaxeElementName or something, which used to tell that get name returns null, but it shouldn't be null.
Also empty completion items, kinda related to that findSubcomponentNames or similar does returns some items which is shown as empty in completion.

@as3boyan
Copy link
Contributor Author

As far as the exceptions go, I thought I fixed the one in HaxeMethodPsiMixinImpl.isPrivate(). I've seen it before. I'm fully synched up, so it must be a different path to the same problem.

I'm unable to find related commit in ClassHierarchy branch of your repository.

@as3boyan
Copy link
Contributor Author

#56
#52
and this one is pretty critical, some functionality is broken, I think those issues should have high priority now. We need to find a way to fix them.

I'm unable to find related commit in ClassHierarchy branch of your repository.

Sorry, I misread your message.

@as3boyan
Copy link
Contributor Author

So perhaps those things stop us from making stable release.

@EBatTiVo
Copy link
Contributor

EBatTiVo commented Dec 4, 2014

The error was introduced by change aa854a6.

The "statement" rule in haxe.bnf was no longer private. That added new "statement" psi constructs around a number of elements. Most importantly, for our current conundrum, the ASSIGN_DECLARATION and the LOCAL_VAR_DECLARATION elements.

The algorithm that searches for local variables simply looked at the next level up (recursively) in the hierarchy when looking for a declaration to resolve to. Now that we've added the extra layer, the variable declaration isn't found; the STATEMENT element is, and it doesn't match the search type, so the element is skipped.

One way out would be to make the STATEMENT element private again in the BNF. That brings along a number of other issues, the primary one being that we need a realization of the HaxeStatementImpl class in order to implement HaxeBlockStatementPsiMixin and HaxePackageStatementPsiMixin (and their respective Impl classes). And we need these to so that we have a class of the type PsiCodeblock to interoperate with some of the Java language functionality.

Another potential implementation is to traverse back down one level in the traversal algorithm when we see a STATEMENT element. The algorithm is fairly generic right now, so this will force some specialization. The code that would have to change is PsiTreeUtil.treeWalkUp().

EBatTiVo added a commit that referenced this issue Dec 5, 2014
…ent'

element in grammar/haxe.bnf private again.  This removed the intermediate
'STATEMENT' elements from the Psi, and allowed the references to be found
naturally by walking up the tree.  To get variable names in for loops
to resolve, added a new HaxeForStatementPsiMixin interface and impl class.
The new class was needed because for statements still need to be PsiStatements
(via HaxeStatement) and need to the AbstractHaxeNamedComponents for the
resolution logic to work.
@EBatTiVo
Copy link
Contributor

EBatTiVo commented Dec 5, 2014

Fixed with c65b928.
In build TiVo.ClassHierarchy.7: 8a9efba

Repair variable name resolving (TiVo/#47). To do so, made the 'statement'
element in grammar/haxe.bnf private again. This removed the intermediate
'STATEMENT' elements from the Psi, and allowed the references to be found
naturally by walking up the tree. To get variable names in for loops
to resolve, added a new HaxeForStatementPsiMixin interface and impl class.
The new class was needed because for statements still need to be PsiStatements
(via HaxeStatement) and need to the AbstractHaxeNamedComponents for the
resolution logic to work.

Test program I was using:

package ;
import as.be.sed;
class QuickResolveTest {
    public function new() {
        var longerVarName:Int;
        longerVarName = 1;
        for (forLoopVar in 1...10) {
          var internalToForLoop: Int
          internalToForLoop = forLoopVar;
        }
        var even_numbers = [for (i in 1...10) i * 2];
        trace (even_numbers)
    }
    public function test1(param1:Int, param2:Float, param3:String) {
        ++param1;
        trace (param1);
        trace (++param2);
        trace (param3)
    }
}

@grisevg
Copy link

grisevg commented Dec 5, 2014

Yes! Thank you!

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

No branches or pull requests

3 participants