File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -378,7 +378,6 @@ object Contexts {
378378 * - as scope: The parameters of the auxiliary constructor.
379379 */
380380 def thisCallArgContext : Context = {
381- assert(owner.isClassConstructor)
382381 val constrCtx = outersIterator.dropWhile(_.outer.owner == owner).next()
383382 superOrThisCallContext(owner, constrCtx.scope)
384383 .setTyperState(typerState)
Original file line number Diff line number Diff line change @@ -747,7 +747,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
747747 * otherwise the current context.
748748 */
749749 def argCtx (app : untpd.Tree )(implicit ctx : Context ): Context =
750- if (untpd.isSelfConstrCall(app)) ctx.thisCallArgContext else ctx
750+ if (ctx.owner.isClassConstructor && untpd.isSelfConstrCall(app)) ctx.thisCallArgContext
751+ else ctx
751752
752753 /** Typecheck application. Result could be an `Apply` node,
753754 * or, if application is an operator assignment, also an `Assign` or
Original file line number Diff line number Diff line change 1+ object i0 {
2+ 1 match {
3+ def this (): Int // error // error
4+ def this () // error
5+ } // error
6+ }
You can’t perform that action at this time.
0 commit comments