Skip to content

def in structural type is rejected, but val is accepted #1175

Closed
@samuelgruetter

Description

@samuelgruetter
object StructuralTypes {
  type A = { def foo: Int }
  type B = { val foo: Int }
}

dotty rejects this example:

[error] /home/sam/Documents/git/scalameta/tutorial/src/main/resources/StructuralTypes.scala:2: error: refinement method foo without matching type in parent Object
[error]   type A = { def foo: Int }
[error]                  ^
[error] one error found

scalac accepts it, and I guess dotty should as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions