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

Relax restriction on .modify call after .from in ModuleDef DSL, allow widening implementation type. Apply .namedByImpl after modifications, not before #2221

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ object AbstractBindingDefDSL {
case _: SetImpl => 0
case _: AddTags => 0
case _: SetId => 0
case _: SetIdFromImplName => 1
case _: Modify[?] => 2
case _: Modify[?] => 1
case _: SetIdFromImplName => 2
case _: AliasTo => 3
}
sortedOps.foreach {
Expand All @@ -406,11 +406,11 @@ object AbstractBindingDefDSL {
b.implementation match {
case ImplDef.ProviderImpl(implType, function) =>
val newProvider = functoidModifier(Functoid(function)).get
if (newProvider.ret <:< implType) {
if (newProvider.ret <:< b.key.tpe) {
b = b.withImplDef(ImplDef.ProviderImpl(implType, newProvider))
} else {
throw new InvalidFunctoidModifier(
s"Cannot apply invalid Functoid modifier $functoidModifier, new return type `${newProvider.ret}` is not a subtype of the old return type `${function.ret}` (${initial.origin})"
s"Cannot apply invalid Functoid modifier $functoidModifier, new return type `${newProvider.ret}` is not a subtype of the key type `${b.key.tpe}` (${initial.origin})"
)
}
case _ =>
Expand Down
Loading