mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix SOE in G++ type inference
This commit is contained in:
+2
-2
@@ -47,9 +47,9 @@ public class GppExpectedTypesContributor extends GroovyExpectedTypesContributor
|
||||
assert argIndex >= 0;
|
||||
|
||||
final ArrayList<TypeConstraint> result = new ArrayList<TypeConstraint>();
|
||||
for (PsiType type : GroovyExpectedTypesProvider.getDefaultExpectedTypes(expression)) {
|
||||
for (PsiType type : GroovyExpectedTypesProvider.getDefaultExpectedTypes(list)) {
|
||||
if (type instanceof PsiClassType) {
|
||||
for (GroovyResolveResult resolveResult : PsiUtil.getConstructorCandidates((PsiClassType)type, argTypes, expression)) {
|
||||
for (GroovyResolveResult resolveResult : PsiUtil.getConstructorCandidates((PsiClassType)type, argTypes, list)) {
|
||||
final PsiElement method = resolveResult.getElement();
|
||||
if (method instanceof PsiMethod && ((PsiMethod)method).isConstructor()) {
|
||||
final PsiParameter[] constructorParameters = ((PsiMethod)method).getParameterList().getParameters();
|
||||
|
||||
@@ -424,6 +424,23 @@ s.do<caret>Smth()
|
||||
@Typed File foo() { ['super':['a']] }
|
||||
@Typed File goo() { <warning descr="Cannot assign 'Map' to 'File'">[:]</warning> }
|
||||
File bar() { <warning descr="Cannot assign 'Map' to 'File'">[:]</warning> }
|
||||
"""
|
||||
myFixture.enableInspections new GroovyAssignabilityCheckInspection()
|
||||
myFixture.checkHighlighting(true, false, false)
|
||||
}
|
||||
|
||||
public void testNestedLiteralConstructors() throws Exception {
|
||||
configureGppScript """
|
||||
class Foo {
|
||||
def Foo(Bar b) { }
|
||||
}
|
||||
|
||||
class Bar {
|
||||
def Bar(int i) { }
|
||||
}
|
||||
|
||||
Foo x = [[2]]
|
||||
println x
|
||||
"""
|
||||
myFixture.enableInspections new GroovyAssignabilityCheckInspection()
|
||||
myFixture.checkHighlighting(true, false, false)
|
||||
|
||||
Reference in New Issue
Block a user