Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline traits for specialization in Scala 3 (v2) #20254

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 24, 2024

An alternative implementation of #17329. This implementation uses a two-step approach to inlining the definitions. The basic design is discussed in section 5.3.2 of https://infoscience.epfl.ch/record/303591?ln=en.

The idea is to inline a trait

inline trait A:
  def f(x1: T1, ...): R = ...

into

class B extends A
//  def f(x1: T1, ...): R = super[A].f(x1, ...)

The TraitInlining transform will generate the definition that are in A but not in B. The super[A].f(x1, ...) will be treated as an inline call in the Inlining phase.

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.

None yet

2 participants