backend: Fix enum constructor default parameters

The problem was observed in the follwing code:

enum class A(one: Int, val two: Int = one) ...

The problem is in the `two` default value. Here the enum constructor
lowering used an old (not lowered) symbol for `one`. Also the lowering
didn't copy the default expression for DEFAULT class.
The patch fixes both problems.
This commit is contained in:
Ilya Matveev
2017-06-09 19:20:54 +07:00
committed by ilmat192
parent e64a5f42f0
commit 07c8404a5e
3 changed files with 37 additions and 12 deletions
+15 -10
View File
@@ -252,52 +252,57 @@ task sum2(type: RunKonanTest) {
source = "codegen/function/sum_imm.kt"
}
task defaults(type: RunKonanTest) {
task function_defaults(type: RunKonanTest) {
source = "codegen/function/defaults.kt"
}
task defaults1(type: RunKonanTest) {
task function_defaults1(type: RunKonanTest) {
source = "codegen/function/defaults1.kt"
}
task defaults2(type: RunKonanTest) {
task function_defaults2(type: RunKonanTest) {
source = "codegen/function/defaults2.kt"
}
task defaults3(type: RunKonanTest) {
task function_defaults3(type: RunKonanTest) {
source = "codegen/function/defaults3.kt"
}
task defaults4(type: RunKonanTest) {
task function_defaults4(type: RunKonanTest) {
goldValue = "43\n"
source = "codegen/function/defaults4.kt"
}
task defaults5(type: RunKonanTest) {
task function_defaults5(type: RunKonanTest) {
goldValue = "5\n6\n"
source = "codegen/function/defaults5.kt"
}
task defaults6(type: RunKonanTest) {
task function_defaults6(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/function/defaults6.kt"
}
task defaults7(type: RunKonanTest) {
task function_defaults7(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/function/defaults7.kt"
}
task defaults8(type: RunKonanTest) {
task function_defaults8(type: RunKonanTest) {
goldValue = "2\n"
source = "codegen/function/defaults8.kt"
}
task defaults9(type: RunKonanTest) {
task function_defaults9(type: RunKonanTest) {
goldValue = "1\n"
source = "codegen/function/defaults9.kt"
}
task function_defaults10(type: RunKonanTest) {
goldValue = "42\n"
source = "codegen/function/defaults10.kt"
}
task sum_3const(type: RunKonanTest) {
source = "codegen/function/sum_3const.kt"
}