Fix KT-10764 IDEA doesn't show overload conflict between constructor and function...

When checking for overloads in package, consider functions and top-level class constructors as possibly conflicting between each other. NB OverloadUtil uses containing package scope from module descriptor.

Change diagnostic message for CONFLICTING_OVERLOAD: it's misleading in case of fun vs constructor conflict.

Add custom multifile test for diagnostics in IDE (probably not the best; should preprocess file content if it's required to check highlighting in multiple files, not only in the first file).

Add test for KT-10765 Incremental compilation misses overload conflict between constructor and function ...
This commit is contained in:
Dmitry Petrov
2016-02-01 16:27:58 +03:00
parent 7dd725f0a4
commit 65f754ffca
36 changed files with 193 additions and 84 deletions
@@ -1,3 +1,3 @@
<!-- conflictingOverloadsClass1 -->
<html>
'<b>public</b> <b>final</b> <b>fun</b> lol(x: kotlin.Int): kotlin.Int'<br />is already defined in conflictingOverloads</html>
'<b>public</b> <b>final</b> <b>fun</b> lol(x: kotlin.Int): kotlin.Int'<br />conflicts with another declaration: <b>public</b> <b>final</b> <b>fun</b> lol(y: kotlin.Int): kotlin.Int</html>
@@ -1,3 +1,3 @@
<!-- conflictingOverloadsClass2 -->
<html>
'<b>public</b> <b>final</b> <b>fun</b> lol(y: kotlin.Int): kotlin.Int'<br />is already defined in conflictingOverloads</html>
'<b>public</b> <b>final</b> <b>fun</b> lol(y: kotlin.Int): kotlin.Int'<br />conflicts with another declaration: <b>public</b> <b>final</b> <b>fun</b> lol(x: kotlin.Int): kotlin.Int</html>
@@ -1,2 +1,2 @@
<!-- conflictingOverloadsDefaultPackage1 -->
'public fun foo(x: kotlin.Int): kotlin.Int' is already defined in root package
'public fun foo(x: kotlin.Int): kotlin.Int' conflicts with another declaration: public fun foo(y: kotlin.Int): kotlin.Int
@@ -1,2 +1,2 @@
<!-- conflictingOverloadsDefaultPackage2 -->
'public fun foo(y: kotlin.Int): kotlin.Int' is already defined in root package
'public fun foo(y: kotlin.Int): kotlin.Int' conflicts with another declaration: public fun foo(x: kotlin.Int): kotlin.Int
@@ -1,2 +1,2 @@
<!-- constructorsRedeclaration1 -->
'public constructor Element(x: kotlin.String)' is already defined in Element
'public constructor Element(x: kotlin.String)' conflicts with another declaration: public constructor Element(x: kotlin.String)
@@ -1,2 +1,2 @@
<!-- constructorsRedeclaration2 -->
'public constructor Element(x: kotlin.String)' is already defined in Element
'public constructor Element(x: kotlin.String)' conflicts with another declaration: public constructor Element(x: kotlin.String)
@@ -1,2 +1,2 @@
<!-- constructorsRedeclarationTopLevel1 -->
'public fun Element(x: kotlin.String): kotlin.Unit' is already defined in root package
'public fun Element(x: kotlin.String): kotlin.Unit' conflicts with another declaration: public constructor Element(x: kotlin.String)
@@ -1,2 +1,2 @@
<!-- constructorsRedeclarationTopLevel2 -->
'public constructor Element(x: kotlin.String)' is already defined in Element
'public constructor Element(x: kotlin.String)' conflicts with another declaration: public fun Element(x: kotlin.String): kotlin.Unit