Skip to content

Self-typed inheritance crashing compiler #23692

@jnatten

Description

@jnatten

Compiler version 3.3.6 / 3.7.2 (mill)

Minimized code

Im not able to produce a very minimal code example, but our repository is open source and this is a branch i will not touch that has this error and the file mention in the compiler error is this one:

ArticleIndexService

which inherits IndexService.scala

which then again inherits BaseIndexService

We are implementing cake-pattern by wrapping our classes with self-typed traits so i assume that is part of the issue.

The command to compile/run tests is ./mill article-api.test

It also works if i change IndexService and BaseIndexService to be abstract classes instead of traits.

The error can be "fixed" if i stop extending IndexService in that one OR if i in IndexService stops extending BaseIndexService OR if i remove every method from BaseIndexService and implement everything in IndexService (Or just replace them with ???).

Output

https://gist.github.com/jnatten/be68f2fd1020a686d37e7c4f733b801a

Expectation

Would expect the compiler to not crash, but rather give me a compile error if there are any errors?

We are in the process of migrating our codebase to scala 3 and when doing so i run into this issue.
We are also considering rewriting our cake pattern stuff to given/using syntax for DI.
Does anyone know if that would work around this issue?

Any feedback would be greatly appreciated.

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