Skip to content

Error with dependent parameters with default values #4419

Closed
@liufengyun

Description

@liufengyun

The following code is rejected by Dotty, but accepted by Scalac:

class Foo(config: String) {
  case class Bar(val x: Int) {
    def doThings: String = config //Do whatever here
  }
}


object Test {
  def test(foo: Foo)(bar: foo.Bar = foo.Bar(5)) = ???

  test(new Foo("port"))()
}

The error message:

11 |  test(new Foo("port"))()
   |  ^^^^^^^^^^^^^^^^^^^^^
   |  found:    foo$1.Bar
   |  required: ?1.Bar
   |
   |  where:    ?1 is an unknown value of type Foo

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions