Skip to content

Incremental compilation fails for class extending trait with export #11841

Open
@pikinier20

Description

@pikinier20

Compiler version

3.0.0-RC1

Minimized code

First, we compile this code:

class SomeOps:
    def someOperation: String = "asd"
    // def someOperation2: String = "asd"
        
trait SomeTrait:
    object SomeOps extends SomeOps()
    export SomeOps._
    
class MainClass extends SomeTrait:
    def a(str: String): String = someOperation

Then, we change SomeOps:

class SomeOps:
        def someOperation: String = "asd"
        def someOperation2: String = "asd"

And use someOperation2 in MainClass

class MainClass extends SomeTrait:
    def a(str: String): String = someOperation2

When we try to compile that code now, it fails. After sbt clean it compiles.

Output

[error] -- [E006] Not Found Error: /home/fzybala/scala3bench/scala3/src/main/scala/MainClass.scala:4:33 
[error] 4 |    def a(str: String): String = someOperation2
[error]   |                                 ^^^^^^^^^^^^^^
[error]   |                                 Not found: someOperation2
[error] one error found
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 22 mar 2021, 14:31:45

Expectation

This code is correct and compiles after cleaning outputs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions