KT-13961 REDECLARATION not reported on private-in-file 'foo' vs public 'foo' in different file
Private-in-file declarations conflict with public overload-equivalent declarations in other files in the same package. Move functions for grouping possible redeclarations to OverloadResolver (since they are used only there). Refactor redeclarations / conflicting overloads reporting.
This commit is contained in:
@@ -135,8 +135,6 @@ public class IdeErrorMessages {
|
||||
|
||||
MAP.put(MANY_IMPL_MEMBER_NOT_IMPLEMENTED, "<html>{0} must override {1}<br />because it inherits many implementations of it</html>",
|
||||
RENDER_CLASS_OR_OBJECT, HTML);
|
||||
MAP.put(CONFLICTING_OVERLOADS, "<html>''{0}''<br />conflicts with another declaration in {1}</html>",
|
||||
IdeRenderers.HTML_COMPACT_WITH_MODIFIERS, Renderers.DECLARATION_NAME_WITH_KIND);
|
||||
|
||||
MAP.put(RESULT_TYPE_MISMATCH, "<html>Function return type mismatch." +
|
||||
"<table><tr><td>Expected:</td><td>{1}</td></tr>" +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ERROR: 'public open fun foo(): Unit' conflicts with another declaration in class 'C'
|
||||
// ERROR: 'public open fun foo(): Unit' conflicts with another declaration in class 'C'
|
||||
// ERROR: Conflicting overloads: public open fun foo(): Unit defined in C, public open fun foo(): Unit defined in C
|
||||
// ERROR: Conflicting overloads: public open fun foo(): Unit defined in C, public open fun foo(): Unit defined in C
|
||||
interface I {
|
||||
open fun foo(){}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<!-- conflictingOverloadsClass1 -->
|
||||
<html>
|
||||
'<b>public</b> <b>final</b> <b>fun</b> lol(x: Int): Int'<br />conflicts with another declaration in class 'conflictingOverloads'</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- conflictingOverloadsClass1 -->
|
||||
Conflicting overloads: public final fun lol(x: Int): Int defined in conflictingOverloads, public final fun lol(y: Int): Int defined in conflictingOverloads
|
||||
@@ -1,3 +0,0 @@
|
||||
<!-- conflictingOverloadsClass2 -->
|
||||
<html>
|
||||
'<b>public</b> <b>final</b> <b>fun</b> lol(y: Int): Int'<br />conflicts with another declaration in class 'conflictingOverloads'</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- conflictingOverloadsClass2 -->
|
||||
Conflicting overloads: public final fun lol(x: Int): Int defined in conflictingOverloads, public final fun lol(y: Int): Int defined in conflictingOverloads
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- conflictingOverloadsDefaultPackage1 -->
|
||||
'public fun foo(x: Int): Int' conflicts with another declaration in package '<root>'
|
||||
Conflicting overloads: public fun foo(x: Int): Int defined in root package, public fun foo(y: Int): Int defined in root package
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- conflictingOverloadsDefaultPackage2 -->
|
||||
'public fun foo(y: Int): Int' conflicts with another declaration in package '<root>'
|
||||
Conflicting overloads: public fun foo(x: Int): Int defined in root package, public fun foo(y: Int): Int defined in root package
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- constructorsRedeclaration1 -->
|
||||
'public constructor Element(x: String)' conflicts with another declaration in class 'Element'
|
||||
Conflicting overloads: public constructor Element(x: String) defined in Element, public constructor Element(x: String) defined in Element
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- constructorsRedeclaration2 -->
|
||||
'public constructor Element(x: String)' conflicts with another declaration in class 'Element'
|
||||
Conflicting overloads: public constructor Element(x: String) defined in Element, public constructor Element(x: String) defined in Element
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- constructorsRedeclarationTopLevel1 -->
|
||||
'public fun Element(x: String): Unit' conflicts with another declaration in class 'Element'
|
||||
Conflicting overloads: public fun Element(x: String): Unit defined in root package, public constructor Element(x: String) defined in Element
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- constructorsRedeclarationTopLevel2 -->
|
||||
'public constructor Element(x: String)' conflicts with another declaration in package '<root>'
|
||||
Conflicting overloads: public fun Element(x: String): Unit defined in root package, public constructor Element(x: String) defined in Element
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
// "Add constructor parameters from Base(Int, Int, Any, String, String,...)" "true"
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
open class Base<T>(p1: Int, private val p2: Int, p3: Any, p4: String, p5: T, p6: Int)
|
||||
|
||||
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int) : Base<String><caret>
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
// "Add constructor parameters from Base(Int, Int, Any, String, String,...)" "true"
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Redeclaration: p4
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
// ERROR: Conflicting declarations: value-parameter p4: Any, value-parameter p4: String
|
||||
open class Base<T>(p1: Int, private val p2: Int, p3: Any, p4: String, p5: T, p6: Int)
|
||||
|
||||
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int, p1: Int, p4: String) : Base<String><caret>(p1, p2, p3, p4, p5, p6)
|
||||
class C(p: Int, p2: Int, p3: String, p4: Any, p5: String, val p6: Int, p1: Int, p4: String) : Base<String>(p1, p2, p3, p4, p5, p6)
|
||||
|
||||
Reference in New Issue
Block a user