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

Remove ModuleBase#Self type member, use implicit priority-based scheme instead #1036

Merged
merged 5 commits into from
May 4, 2020

Conversation

neko-kai
Copy link
Member

@neko-kai neko-kai commented May 4, 2020

How it works: for a type ModuleDef <: Module <: ModuleBase the priority of companion object searches is ModuleDef -> Module -> ModuleBase such that if we launch a search for ModuleMake[ModuleDef, T], companion object of Module will have a higher priority that companion object of ModuleBase resulting in the instance ModuleMake[Module, Module].

Unfortunately we also have to add an implicit rule transforming any ModuleMake.Aux[X, T] into ModuleMake[T] - to be able to use instance of ModuleMake[T] when there's only an instance of ModuleMake.Aux[X, T] - because the X parameter shouldn't stop us from using the instance, it's only there to make the search happen in the companion objects, i.e. it's a pure phantom parameter, but there's no way to express it in Scala currently.

@neko-kai neko-kai requested a review from pshirshov May 4, 2020 16:49
@neko-kai neko-kai merged commit 2d9f750 into develop May 4, 2020
@neko-kai neko-kai deleted the feature/modulebase-remove-self branch May 4, 2020 17:27
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