diff --git a/compiler/src/dotty/tools/dotc/transform/Memoize.scala b/compiler/src/dotty/tools/dotc/transform/Memoize.scala index b4a90feea3f1..725a92c82f9b 100644 --- a/compiler/src/dotty/tools/dotc/transform/Memoize.scala +++ b/compiler/src/dotty/tools/dotc/transform/Memoize.scala @@ -139,13 +139,12 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase => } else if (sym.isSetter) { if (!sym.is(ParamAccessor)) { val Literal(Constant(())) = tree.rhs } // This is intended as an assertion field.setFlag(Mutable) // Necessary for vals mixed in from Scala2 traits - if (isErasableBottomField(tree.vparamss.head.head.tpt.tpe.classSymbol)) tree - else { - val initializer = Assign(ref(field), adaptToField(ref(tree.vparamss.head.head.symbol))) - val setterDef = cpy.DefDef(tree)(rhs = transformFollowingDeep(initializer)(ctx.withOwner(sym))) - removeAnnotations(sym) - setterDef - } + val initializer = + if (isErasableBottomField(tree.vparamss.head.head.tpt.tpe.classSymbol)) Literal(Constant(())) + else Assign(ref(field), adaptToField(ref(tree.vparamss.head.head.symbol))) + val setterDef = cpy.DefDef(tree)(rhs = transformFollowingDeep(initializer)(ctx.withOwner(sym))) + removeAnnotations(sym) + setterDef } else tree // curiously, some accessors from Scala2 have ' ' suffixes. They count as // neither getters nor setters diff --git a/tests/pending/fuzzy/AE-23b20eba14de058f02b69cb1093063fe12b639fb.scala b/tests/pos/AE-23b20eba14de058f02b69cb1093063fe12b639fb.scala similarity index 100% rename from tests/pending/fuzzy/AE-23b20eba14de058f02b69cb1093063fe12b639fb.scala rename to tests/pos/AE-23b20eba14de058f02b69cb1093063fe12b639fb.scala diff --git a/tests/pos/i5036.scala b/tests/pos/i5036.scala new file mode 100644 index 000000000000..7e8f7fa4c2ce --- /dev/null +++ b/tests/pos/i5036.scala @@ -0,0 +1,3 @@ +class i0(var i1: Unit) +class i1(var i1: Null) +class i3(var i1: Nothing)