mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
lvti: reject initializing var with void (IDEA-188623)
This commit is contained in:
+6
@@ -462,6 +462,12 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
.descriptionAndTooltip("Cannot infer type: variable initializer is 'null'")
|
||||
.range(typeElement).create();
|
||||
}
|
||||
|
||||
if (PsiType.VOID.equals(lType)) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.descriptionAndTooltip("Cannot infer type: variable initializer is 'void'")
|
||||
.range(typeElement).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+2
@@ -33,6 +33,8 @@ class Main {
|
||||
var runnable = true ? <error descr="Lambda expression not expected here">() -> {}</error> : <error descr="Lambda expression not expected here">() -> {}</error>;
|
||||
|
||||
Function<String, String> f1 = (<error descr="Cannot resolve symbol 'var'">var</error> var) -> var;
|
||||
|
||||
<error descr="Cannot infer type: variable initializer is 'void'">var</error> h = localVariableDeclaration();
|
||||
}
|
||||
|
||||
private void forEachType(String[] strs, Iterable<String> it, Iterable raw) {
|
||||
|
||||
Reference in New Issue
Block a user