Skip to content

scalac cannot parse records that implement interfaces #12474

@s5bug

Description

@s5bug

reproduction steps

using Scala 2.13.6, Java 17

sealed and permits commented out due to #12159

public /* sealed */ interface Nat /* permits Nat.Zero, Nat.Succ */ {
    public static final record Zero() implements Nat {}
    public static final record Succ(Nat pred) implements Nat {}
}

problem

`;` expected but `implements` found.
    public static final record Zero() implements Nat {}

The error message is confusing as well, as

public static final record Zero();

does not work, but

public static final record Zero() {}

does.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions