Skip to content

Inline Traits & Specialized Traits#26156

Draft
starswap wants to merge 308 commits into
scala:mainfrom
starswap:specialized-inline-traits
Draft

Inline Traits & Specialized Traits#26156
starswap wants to merge 308 commits into
scala:mainfrom
starswap:specialized-inline-traits

Conversation

@starswap
Copy link
Copy Markdown
Contributor

@starswap starswap commented May 25, 2026

still DRAFT!! : )

Final year master's project at EPFL. Introduces specialization for Scala 3 as an experimental feature, via:

The latest specification for each of these is included in docs accompanying the PR. To see an demo of the generated code and speed gain offered, try tools/benchmarks/SpecializedTraitsBenchmark.scala

How much have you relied on LLM-based tools in this contribution?

Moderately, for debugging.

How was the solution tested?

New automated tests

starswap added 30 commits March 25, 2026 18:38
…s from the parent traits later so they need to live in the children
@starswap starswap force-pushed the specialized-inline-traits branch from d0677c5 to 8855296 Compare June 3, 2026 13:15
@starswap starswap force-pushed the specialized-inline-traits branch from 8855296 to 583a583 Compare June 3, 2026 13:17
@starswap starswap force-pushed the specialized-inline-traits branch from 78aec78 to afd9b33 Compare June 5, 2026 14:46
starswap added 5 commits June 5, 2026 16:46
Opaque types can appear in inline traits. This is not the case for inline methods, so we run into the new case that a LazyBodyAnnotation contains an inline trait. This causes a problem because the LazyBodyAnnotation and the ordinary code both complete the opaque type's LazyRefs which causes us to throw a CyclicReference. It turns out that this CyclicReference throw was originally created for a test case which we no longer reject (typer evolved and we now accept tests/pos/i9052. Therefore we conclude that this CyclicReference is no longer really needed. Removing it allows us to support opaque types in inline traits but it does change the error behaviour of two other tests (modified in this commit). I claim that the resulting errors are acceptable for both of these cases. In particular, the issues they correspond to were both crashes, and we still don't crash without the cyclic reference error. The errors we throw are modified but I think reasonable; feel free to check for yourself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant