File tree Expand file tree Collapse file tree 5 files changed +11
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 5 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ object Inliner {
9797 if tree.symbol.isExperimental then
9898 Feature .checkExperimentalDef(tree.symbol, tree)
9999
100+ if tree.symbol.isConstructor then return tree // error already reported for the inline constructor definition
101+
100102 /** Set the position of all trees logically contained in the expansion of
101103 * inlined call `call` to the position of `call`. This transform is necessary
102104 * when lifting bindings from the expansion to the outside of the call.
Original file line number Diff line number Diff line change @@ -2164,6 +2164,8 @@ class Typer extends Namer
21642164 PrepareInlineable .registerInlineInfo(sym, rhsToInline)
21652165
21662166 if sym.isConstructor then
2167+ if sym.is(Inline ) then
2168+ report.error(" constuctors cannot be `inline`" , ddef)
21672169 if sym.isPrimaryConstructor then
21682170 if sym.owner.is(Case ) then
21692171 for
Original file line number Diff line number Diff line change 1+ class Bar (i : Int ):
2+ inline def this () = this (0 ) // error
Original file line number Diff line number Diff line change 1+ val bar = new Bar ()
Original file line number Diff line number Diff line change 1+ class Bar (i : Int ):
2+ transparent inline def this () = this (0 ) // error
3+
4+ val bar = Bar ()
You can’t perform that action at this time.
0 commit comments