mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] do not try to infer rValue within index property assignment (EA-58298)
This commit is contained in:
+9
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.branch.GrReturnState
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.branch.GrThrowStatement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrIndexProperty;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
@@ -95,7 +96,13 @@ public class SubstitutorComputer {
|
||||
}
|
||||
}
|
||||
else if (parent instanceof GrAssignmentExpression && myPlaceToInferContext.equals(((GrAssignmentExpression)parent).getRValue())) {
|
||||
return ((GrAssignmentExpression)parent).getLValue().getType();
|
||||
GrExpression lValue = ((GrAssignmentExpression)parent).getLValue();
|
||||
if (lValue instanceof GrIndexProperty) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return lValue.getType();
|
||||
}
|
||||
}
|
||||
else if (parent instanceof GrVariable) {
|
||||
return ((GrVariable)parent).getDeclaredType();
|
||||
|
||||
+18
@@ -1969,6 +1969,24 @@ import groovy.transform.Field
|
||||
|
||||
@Field
|
||||
def (,<error descr="Identifier expected">)</error>
|
||||
'''
|
||||
}
|
||||
|
||||
void 'test no SOE in index property assignment with generic function'() {
|
||||
testHighlighting '''
|
||||
class Main {
|
||||
|
||||
static <T> T foo() {}
|
||||
|
||||
static void main(String[] args) {
|
||||
def main = new Main()
|
||||
main[Main] = foo()
|
||||
}
|
||||
|
||||
def putAt(x, String t) {
|
||||
println "Works: $x = $t"
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user