Skip to content

Default arguments of final method are not final #17519

Open
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.0.0 to 3.3.0-RC4

Minimized example

class A:
  final def foo(x: Int = 1): Any = ???

Output

Compiled with -Xprint:typer shows

[[syntax trees at end of                     typer]] 
package <empty> {
  class A() extends Object() {
    final def foo(x: Int): Any = ???
    def foo$default$1: Int @uncheckedVariance = 1
  }
}

Expectation

Default argument methods of final methods should be final.

class A() extends Object() {
  final def foo(x: Int): Any = ???
  final def foo$default$1: Int @uncheckedVariance = 1
}

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