File tree 3 files changed +25
-1
lines changed
compiler/src/dotty/tools/dotc/transform 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,6 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
212
212
}
213
213
splitStats(stats1)
214
214
case Nil =>
215
- (Nil , Nil )
216
215
}
217
216
splitStats(tree.body)
218
217
@@ -222,6 +221,10 @@ class Constructors extends MiniPhase with IdentityDenotTransformer { thisPhase =
222
221
dropped += acc
223
222
Nil
224
223
}
224
+ else if (! isRetained(acc.field)) { // It may happen for unit fields, tests/run/i6987.scala
225
+ dropped += acc.field
226
+ Nil
227
+ }
225
228
else {
226
229
if (acc.hasAnnotation(defn.TransientParamAnnot ))
227
230
ctx.error(em " transient parameter $acc is retained as field in class ${acc.owner}" , acc.sourcePos)
Original file line number Diff line number Diff line change
1
+ class A (val u : Unit )
2
+
3
+ @ main def Test = A (())
Original file line number Diff line number Diff line change
1
+ enum SingleCase {
2
+ case TheCase1 (u : Unit )
3
+ }
4
+
5
+ case class TheCase2 (u : Unit )
6
+
7
+ case class TheCase3 (s : String , u : Unit )
8
+
9
+ class TheCase4 (val u : Unit )
10
+
11
+ abstract class TheCase5 (val u : Unit )
12
+
13
+ @ main def Test =
14
+ SingleCase .TheCase1 (())
15
+ TheCase2 (())
16
+ TheCase3 (" " , ())
17
+ TheCase4 (())
18
+ new TheCase5 (()) {}
You can’t perform that action at this time.
0 commit comments