Replaced Diagnostic.getMessage() with DiagnosticRenderer.render() calls.
Made Diagnostic.getMessage() deprecated, introduced DiagnosticRender interface and default implementation for it.
This commit is contained in:
@@ -35,10 +35,7 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
|||||||
import org.jetbrains.jet.lang.descriptors.ClassOrNamespaceDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassOrNamespaceDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
import org.jetbrains.jet.lang.diagnostics.*;
|
||||||
import org.jetbrains.jet.lang.diagnostics.SimpleDiagnosticFactory;
|
|
||||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
|
|
||||||
import org.jetbrains.jet.lang.diagnostics.Severity;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||||
@@ -150,7 +147,7 @@ public class CompileSession {
|
|||||||
DiagnosticUtils.LineAndColumn lineAndColumn = DiagnosticUtils.getLineAndColumn(diagnostic);
|
DiagnosticUtils.LineAndColumn lineAndColumn = DiagnosticUtils.getLineAndColumn(diagnostic);
|
||||||
VirtualFile virtualFile = diagnostic.getPsiFile().getVirtualFile();
|
VirtualFile virtualFile = diagnostic.getPsiFile().getVirtualFile();
|
||||||
String path = virtualFile == null ? null : virtualFile.getPath();
|
String path = virtualFile == null ? null : virtualFile.getPath();
|
||||||
collector.report(diagnostic.getSeverity(), diagnostic.getMessage(), path, lineAndColumn.getLine(), lineAndColumn.getColumn());
|
collector.report(diagnostic.getSeverity(), DefaultDiagnosticRenderer.INSTANCE.render(diagnostic), path, lineAndColumn.getLine(), lineAndColumn.getColumn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 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.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.compiler;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||||
|
import org.jetbrains.jet.lang.diagnostics.DiagnosticRenderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Evgeny Gerashchenko
|
||||||
|
* @since 4/12/12
|
||||||
|
*/
|
||||||
|
public class DefaultDiagnosticRenderer implements DiagnosticRenderer {
|
||||||
|
public static final DefaultDiagnosticRenderer INSTANCE = new DefaultDiagnosticRenderer();
|
||||||
|
|
||||||
|
private DefaultDiagnosticRenderer() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String render(@Nullable Diagnostic diagnostic) {
|
||||||
|
return diagnostic.getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ public interface Diagnostic {
|
|||||||
@NotNull
|
@NotNull
|
||||||
AbstractDiagnosticFactory getFactory();
|
AbstractDiagnosticFactory getFactory();
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@NotNull
|
@NotNull
|
||||||
String getMessage();
|
String getMessage();
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package org.jetbrains.jet.lang.diagnostics;
|
package org.jetbrains.jet.lang.diagnostics;
|
||||||
|
|
||||||
import com.intellij.openapi.util.TextRange;
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ public interface DiagnosticHolder {
|
|||||||
if (diagnostic.getSeverity() == Severity.ERROR) {
|
if (diagnostic.getSeverity() == Severity.ERROR) {
|
||||||
PsiFile psiFile = diagnostic.getPsiFile();
|
PsiFile psiFile = diagnostic.getPsiFile();
|
||||||
List<TextRange> textRanges = diagnostic.getTextRanges();
|
List<TextRange> textRanges = diagnostic.getTextRanges();
|
||||||
throw new IllegalStateException(diagnostic.getMessage() + DiagnosticUtils.atLocation(psiFile, textRanges.get(0)));
|
throw new IllegalStateException(diagnostic.getFactory().getName() + DiagnosticUtils.atLocation(psiFile, textRanges.get(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 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.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.diagnostics;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Evgeny Gerashchenko
|
||||||
|
* @since 4/12/12
|
||||||
|
*/
|
||||||
|
public interface DiagnosticRenderer extends Renderer<Diagnostic> {
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
String render(@Nullable Diagnostic diagnostic);
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
|
||||||
import org.jetbrains.jet.compiler.JetCoreEnvironment;
|
import org.jetbrains.jet.compiler.JetCoreEnvironment;
|
||||||
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
|
||||||
|
import org.jetbrains.jet.compiler.DefaultDiagnosticRenderer;
|
||||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||||
import org.jetbrains.jet.lang.diagnostics.Severity;
|
import org.jetbrains.jet.lang.diagnostics.Severity;
|
||||||
import org.jetbrains.jet.lang.diagnostics.UnresolvedReferenceDiagnostic;
|
import org.jetbrains.jet.lang.diagnostics.UnresolvedReferenceDiagnostic;
|
||||||
@@ -153,11 +154,14 @@ public class JetTestUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void report(@NotNull Diagnostic diagnostic) {
|
public void report(@NotNull Diagnostic diagnostic) {
|
||||||
if (diagnostic.getSeverity() == Severity.ERROR) {
|
if (diagnostic.getSeverity() == Severity.ERROR) {
|
||||||
throw new IllegalStateException(diagnostic.getMessage());
|
throw new IllegalStateException(DefaultDiagnosticRenderer.INSTANCE.render(diagnostic));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private JetTestUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static AnalyzeExhaust analyzeFile(@NotNull JetFile namespace, @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
|
public static AnalyzeExhaust analyzeFile(@NotNull JetFile namespace, @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
|
||||||
return AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(namespace, flowDataTraceFactory,
|
return AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(namespace, flowDataTraceFactory,
|
||||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR));
|
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR));
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.intellij.psi.PsiReference;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.annotations.TestOnly;
|
import org.jetbrains.annotations.TestOnly;
|
||||||
|
import org.jetbrains.jet.compiler.DefaultDiagnosticRenderer;
|
||||||
import org.jetbrains.jet.lang.diagnostics.*;
|
import org.jetbrains.jet.lang.diagnostics.*;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
import org.jetbrains.jet.lang.psi.JetReferenceExpression;
|
||||||
@@ -154,7 +155,7 @@ public class JetPsiChecker implements Annotator {
|
|||||||
for (TextRange range : mrr.getRanges()) {
|
for (TextRange range : mrr.getRanges()) {
|
||||||
Annotation annotation = holder.createErrorAnnotation(
|
Annotation annotation = holder.createErrorAnnotation(
|
||||||
range.shiftRight(referenceExpression.getTextOffset()),
|
range.shiftRight(referenceExpression.getTextOffset()),
|
||||||
diagnostic.getMessage());
|
getMessage(diagnostic));
|
||||||
|
|
||||||
registerQuickFix(annotation, diagnostic);
|
registerQuickFix(annotation, diagnostic);
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ public class JetPsiChecker implements Annotator {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (TextRange textRange : textRanges) {
|
for (TextRange textRange : textRanges) {
|
||||||
Annotation annotation = holder.createErrorAnnotation(textRange, diagnostic.getMessage());
|
Annotation annotation = holder.createErrorAnnotation(textRange, getMessage(diagnostic));
|
||||||
registerQuickFix(annotation, diagnostic);
|
registerQuickFix(annotation, diagnostic);
|
||||||
annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
|
annotation.setHighlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL);
|
||||||
}
|
}
|
||||||
@@ -239,10 +240,11 @@ public class JetPsiChecker implements Annotator {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static String getMessage(@NotNull Diagnostic diagnostic) {
|
private static String getMessage(@NotNull Diagnostic diagnostic) {
|
||||||
|
String message = DefaultDiagnosticRenderer.INSTANCE.render(diagnostic);
|
||||||
if (ApplicationManager.getApplication().isInternal() || ApplicationManager.getApplication().isUnitTestMode()) {
|
if (ApplicationManager.getApplication().isInternal() || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
return "[" + diagnostic.getFactory().getName() + "] " + diagnostic.getMessage();
|
return "[" + diagnostic.getFactory().getName() + "] " + message;
|
||||||
}
|
}
|
||||||
return diagnostic.getMessage();
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -8,19 +8,19 @@ class B() : A() {
|
|||||||
|
|
||||||
fun f9(a : A?) {
|
fun f9(a : A?) {
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
|
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
if (a is B) {
|
if (a is B) {
|
||||||
<info descr="Automatically cast to B">a</info>.bar()
|
<info descr="Automatically cast to B">a</info>.bar()
|
||||||
<info descr="Automatically cast to B">a</info>.foo()
|
<info descr="Automatically cast to B">a</info>.foo()
|
||||||
}
|
}
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
|
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
if (!(a is B)) {
|
if (!(a is B)) {
|
||||||
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
|
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
}
|
}
|
||||||
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == #()) {
|
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == #()) {
|
||||||
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
|
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
}
|
}
|
||||||
if (!(a is B)) {
|
if (!(a is B)) {
|
||||||
return;
|
return;
|
||||||
@@ -55,7 +55,7 @@ fun f11(a : A?) {
|
|||||||
is B -> <info descr="Automatically cast to B">a</info>.bar()
|
is B -> <info descr="Automatically cast to B">a</info>.bar()
|
||||||
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any -> <info descr="Automatically cast to A">a</info>.foo()
|
is Any -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any? -> a.<error descr="Unresolved reference: bar">bar</error>()
|
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
else -> a<info>?.</info>foo()
|
else -> a<info>?.</info>foo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ fun f12(a : A?) {
|
|||||||
is B -> <info descr="Automatically cast to B">a</info>.bar()
|
is B -> <info descr="Automatically cast to B">a</info>.bar()
|
||||||
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any -> <info descr="Automatically cast to A">a</info>.foo();
|
is Any -> <info descr="Automatically cast to A">a</info>.foo();
|
||||||
is Any? -> a.<error descr="Unresolved reference: bar">bar</error>()
|
is Any? -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> -> c.foo()
|
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> -> c.foo()
|
||||||
is val c is C -> <info descr="Automatically cast to C">c</info>.bar()
|
is val c is C -> <info descr="Automatically cast to C">c</info>.bar()
|
||||||
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
|
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
|
||||||
@@ -73,7 +73,7 @@ fun f12(a : A?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (a is val b) {
|
if (a is val b) {
|
||||||
a<info>?.</info><error descr="Unresolved reference: bar">bar</error>()
|
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
|
||||||
b<info>?.</info>foo()
|
b<info>?.</info>foo()
|
||||||
}
|
}
|
||||||
if (a is val b is B) {
|
if (a is val b is B) {
|
||||||
@@ -90,17 +90,17 @@ fun f13(a : A?) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
if (!(a is val c is B)) {
|
if (!(a is val c is B)) {
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<info descr="Automatically cast to B">a</info>.foo()
|
<info descr="Automatically cast to B">a</info>.foo()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
@@ -110,16 +110,16 @@ fun f13(a : A?) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
a<info>?.</info>foo()
|
a<info>?.</info>foo()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(a is val c is B) || !(a is val x is C)) {
|
if (!(a is val c is B) || !(a is val x is C)) {
|
||||||
<error descr="Unresolved reference: x">x</error>
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
|
||||||
<error descr="Unresolved reference: c">c</error>
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
<error descr="Unresolved reference: x">x</error>
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: x">x</error>
|
||||||
<error descr="Unresolved reference: c">c</error>
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(a is val c is B) || !(a is val c is C)) {
|
if (!(a is val c is B) || !(a is val c is C)) {
|
||||||
@@ -127,21 +127,21 @@ fun f13(a : A?) {
|
|||||||
|
|
||||||
if (!(a is val c is B)) return
|
if (!(a is val c is B)) return
|
||||||
<info descr="Automatically cast to B">a</info>.bar()
|
<info descr="Automatically cast to B">a</info>.bar()
|
||||||
<error descr="Unresolved reference: c">c</error>.foo()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.foo()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun f14(a : A?) {
|
fun f14(a : A?) {
|
||||||
while (!(a is val c is B)) {
|
while (!(a is val c is B)) {
|
||||||
}
|
}
|
||||||
<info descr="Automatically cast to B">a</info>.bar()
|
<info descr="Automatically cast to B">a</info>.bar()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
fun f15(a : A?) {
|
fun f15(a : A?) {
|
||||||
do {
|
do {
|
||||||
} while (!(a is val c is B))
|
} while (!(a is val c is B))
|
||||||
<info descr="Automatically cast to B">a</info>.bar()
|
<info descr="Automatically cast to B">a</info>.bar()
|
||||||
<error descr="Unresolved reference: c">c</error>.bar()
|
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: c">c</error>.bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStringLength(obj : Any) : Char? {
|
fun getStringLength(obj : Any) : Char? {
|
||||||
@@ -217,20 +217,20 @@ fun declarationInsidePattern(x: #(Any, Any)): String = when(x) { is #(val a is S
|
|||||||
|
|
||||||
fun mergeAutocasts(a: Any?) {
|
fun mergeAutocasts(a: Any?) {
|
||||||
if (a is String || a is Int) {
|
if (a is String || a is Int) {
|
||||||
a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
||||||
<info descr="Automatically cast to jet.Any">a</info>.toString()
|
<info descr="Automatically cast to jet.Any">a</info>.toString()
|
||||||
}
|
}
|
||||||
if (a is Int || a is String) {
|
if (a is Int || a is String) {
|
||||||
a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
||||||
}
|
}
|
||||||
<error>when</error> (a) {
|
<error>when</error> (a) {
|
||||||
is String, is Any -> a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
is String, is Any -> a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("")
|
||||||
}
|
}
|
||||||
if (a is String && a is Any) {
|
if (a is String && a is Any) {
|
||||||
val <warning>i</warning>: Int = <info descr="Automatically cast to jet.String">a</info>.compareTo("")
|
val <warning>i</warning>: Int = <info descr="Automatically cast to jet.String">a</info>.compareTo("")
|
||||||
}
|
}
|
||||||
if (a is String && <info descr="Automatically cast to jet.String">a</info>.compareTo("") == 0) {}
|
if (a is String && <info descr="Automatically cast to jet.String">a</info>.compareTo("") == 0) {}
|
||||||
if (a is String || a.<error descr="Unresolved reference: compareTo">compareTo</error>("") == 0) {}
|
if (a is String || a.<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: compareTo">compareTo</error>("") == 0) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mutability
|
//mutability
|
||||||
|
|||||||
Reference in New Issue
Block a user