[FIR] Throw REDECLARATION for duplicated enum entries

This commit is contained in:
Ivan Kochurkin
2021-08-05 22:22:28 +03:00
committed by Space
parent 9736cc162b
commit c19598c2fc
3 changed files with 3 additions and 29 deletions
@@ -142,7 +142,7 @@ interface FirDeclarationPresenter {
appendRepresentation(it.returnTypeRef)
}
fun represent(it: FirProperty) = buildString {
fun represent(it: FirVariable) = buildString {
append('[')
it.receiverTypeRef?.let {
appendRepresentation(it)
@@ -241,7 +241,7 @@ open class FirDeclarationInspector(
declaration is FirSimpleFunction -> collectFunction(presenter.represent(declaration), declaration)
declaration is FirRegularClass -> collectNonFunctionDeclaration(presenter.represent(declaration), declaration)
declaration is FirTypeAlias -> collectNonFunctionDeclaration(presenter.represent(declaration), declaration)
declaration is FirProperty -> collectNonFunctionDeclaration(presenter.represent(declaration), declaration)
declaration is FirVariable -> collectNonFunctionDeclaration(presenter.represent(declaration), declaration)
}
}
@@ -1,27 +0,0 @@
//KT-2418 Front-end allows enum constants with same name
package kt2418
enum class A {
FOO,
FOO
}
enum class B {
FOO;
fun FOO() {}
}
enum class C {
FOO;
val FOO = 1
}
enum class D {
FOO;
class FOO {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-2418 Front-end allows enum constants with same name
package kt2418