Skip to content

reporting.diagnostic.messages.Error #5045

@sir-wabbit

Description

@sir-wabbit
class I1(i2: Int) {
  class I1[I3] {
    def apply(i4: Int) = 1
    new I1[Int]()(2) {}
  }
}

without -Ycheck:all it gives a weird error:

4 |    new I1[Int]()(2) {}
  |    ^
  |wrong number of arguments at getClass for ($outer: I1): I1.this.I1: (($outer: I1): I1.this.I1)(this.<init>), expected: 1, found: 0
one error found

with -Ycheck:all

checking E-6cfc2bdeca4ea50004eafb57de18c7e149e70182.scala after phase MegaPhase{elimErasedValueType, vcElideAllocations, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
exception while typing super() of class class dotty.tools.dotc.ast.Trees$Apply # 1048
exception while typing final class $anon($outer: I1.this.I1) extends Int { 
  super()
  private val $outer: I1.this.I1
  private <accessor> def $outer(): I1.this.I1 = this.$outer
  final def I1$I1$_$$anon$$$outer(): I1.this.I1 = $outer()
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1050
exception while typing {
  final class $anon($outer: I1.this.I1) extends Int { 
    super()
    private val $outer: I1.this.I1
    private <accessor> def $outer(): I1.this.I1 = this.$outer
    final def I1$I1$_$$anon$$$outer(): I1.this.I1 = $outer()
  }
  new I1.this.I1{...}(this): I1.this.I1
} of class class dotty.tools.dotc.ast.Trees$Block # 1240
exception while typing class I1($outer: I1) extends Object { 
  super()
  def apply(i4: Int): Int = 1
  {
    final class $anon($outer: I1.this.I1) extends Int { 
      super()
      private val $outer: I1.this.I1
      private <accessor> def $outer(): I1.this.I1 = this.$outer
      final def I1$I1$_$$anon$$$outer(): I1.this.I1 = $outer()
    }
    new I1.this.I1{...}(this): I1.this.I1
  }
  private val $outer: I1
  private <accessor> def $outer(): I1 = this.$outer
  final def I1$I1$$$outer(): I1 = I1.this.$outer()
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1256
exception while typing @scala.annotation.internal.SourceFile(
  "E-6cfc2bdeca4ea50004eafb57de18c7e149e70182.scala"
) class I1(i2: Int) extends Object { 
  super()
  private val i2: Int
  class I1($outer: I1) extends Object { 
    super()
    def apply(i4: Int): Int = 1
    {
      final class $anon($outer: I1.this.I1) extends Int { 
        super()
        private val $outer: I1.this.I1
        private <accessor> def $outer(): I1.this.I1 = this.$outer
        final def I1$I1$_$$anon$$$outer(): I1.this.I1 = $outer()
      }
      new I1.this.I1{...}(this): I1.this.I1
    }
    private val $outer: I1
    private <accessor> def $outer(): I1 = this.$outer
    final def I1$I1$$$outer(): I1 = I1.this.$outer()
  }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1265
exception while typing package <empty> {
  @scala.annotation.internal.SourceFile(
    "E-6cfc2bdeca4ea50004eafb57de18c7e149e70182.scala"
  ) class I1(i2: Int) extends Object { 
    super()
    private val i2: Int
    class I1($outer: I1) extends Object { 
      super()
      def apply(i4: Int): Int = 1
      {
        final class $anon($outer: I1.this.I1) extends Int { 
          super()
          private val $outer: I1.this.I1
          private <accessor> def $outer(): I1.this.I1 = this.$outer
          final def I1$I1$_$$anon$$$outer(): I1.this.I1 = $outer()
        }
        new I1.this.I1{...}(this): I1.this.I1
      }
      private val $outer: I1
      private <accessor> def $outer(): I1 = this.$outer
      final def I1$I1$$$outer(): I1 = I1.this.$outer()
    }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1266
*** error while checking E-6cfc2bdeca4ea50004eafb57de18c7e149e70182.scala after phase capturedVars ***
exception occurred while compiling E-6cfc2bdeca4ea50004eafb57de18c7e149e70182.scala
Exception in thread "main" class dotty.tools.dotc.reporting.diagnostic.messages$Error at E-6cfc2bdeca4ea50004eafb57de18c7e149e70182.scala:4: not enough arguments for constructor I1: ($outer: I1): I1.this.I1
	at dotty.tools.dotc.reporting.Reporting.error(Reporter.scala:96)
	at dotty.tools.dotc.typer.Applications$TypedApply.fail(Applications.scala:587)
	at dotty.tools.dotc.typer.Applications$Application.missingArg$2(Applications.scala:445)
	at dotty.tools.dotc.typer.Applications$Application.tryDefault$1(Applications.scala:450)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:476)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:256)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:565)
	at dotty.tools.dotc.typer.Applications$ApplyToTyped.<init>(Applications.scala:671)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:721)
	at dotty.tools.dotc.typer.Applications.realApply$4$$anonfun$3(Applications.scala:748)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:1984)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:759)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:794)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1818)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1869)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:112)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:282)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1900)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1912)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:270)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1952)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1965)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:446)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1565)

E-6cfc2bdeca4ea50004eafb57de18c7e149e70182

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions