File tree 2 files changed +31
-1
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
116
116
* This info is used in phase ParamForwarding
117
117
*/
118
118
private def forwardParamAccessors (impl : Template )(using Context ): Unit = impl.parents match
119
- case superCall @ Apply (fn, superArgs) :: _ if superArgs.nonEmpty =>
119
+ case superCall @ Apply (fn, superArgs) :: _
120
+ if superArgs.nonEmpty && fn.symbol.isPrimaryConstructor =>
120
121
fn.tpe.widen match
121
122
case MethodType (superParamNames) =>
122
123
for case stat : ValDef <- impl.body do
Original file line number Diff line number Diff line change
1
+ class Foo (val s : Any ):
2
+ def this (s : String ) =
3
+ this (0 )
4
+ class Bar (s : String ) extends Foo (s):
5
+ def foo = s
6
+
7
+ class Foo2 (val s : Any )
8
+ class Bar2 (s : String ) extends Foo2 (s):
9
+ def foo = s
10
+
11
+ case class Config (_config : String )
12
+
13
+ abstract class Foo3 (val config : Config ) {
14
+ def this (config : String ) = {
15
+ this (Config (config))
16
+ }
17
+ }
18
+
19
+ class Bar3 (config : String ) extends Foo3 (config) {
20
+ def foo (): Unit = {
21
+ config.getClass()
22
+ }
23
+ }
24
+
25
+
26
+ @ main def Test =
27
+ Bar (" " ).foo
28
+ Bar2 (" " ).foo
29
+ Bar3 (" " ).foo()
You can’t perform that action at this time.
0 commit comments