Report conflicting overloads for constructors
- It's worked almost fine but diagnostics were filtered out by positioning strategy. - Also a couple of "put" calls to Multimap are replaced by "putValues" within OverloadResolver, that is more semantically correct. - Note that constructors of top-level classes are handled when processing package, it helps to figure out if there are clashes with top-level functions that have the same name. - But constructors of different classes are not reported as overloads because containing classes has the same name and will be reported as redeclaration.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class <!CONFLICTING_OVERLOADS!>A(x: String = "", y: String = "")<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y) {}
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
|
||||
}
|
||||
|
||||
class B {
|
||||
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!> {}
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
|
||||
|
||||
class Outer {
|
||||
class <!CONFLICTING_OVERLOADS!>A(x: String = "", y: String = "")<!> {
|
||||
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y) {}
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
|
||||
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
|
||||
}
|
||||
|
||||
class B {
|
||||
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!> {
|
||||
}
|
||||
}
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
|
||||
}
|
||||
Reference in New Issue
Block a user