Skip to content

Allow overriding inline members of anonymous instance defined inside inline method #14226

Closed
@Iltotore

Description

@Iltotore

Compiler version

3.1.0

Minimized code

trait Test {

  inline def msg: String
}

//Does not compile
inline def foo: Test = new Test {

  override inline def msg: String = "hello" 
}


//Compiles
class HelloTest extends Test {

  override inline def msg: String = "hello"
}

inline def foo: Test = new HelloTest

Output

The first example does not compile and gives an

Implementation restriction: nested inline methods are not supported

Expectation

I would expect the first sample to compile and behave like the second one. The "nested inline" error seems to be a false-positive.

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