Closed ta0kira closed 4 years ago
Went with the suggested solution above.
There's actually still an issue when a function with param #x
is inherited in a category that has a top-level param #x
and the latter doesn't explicitly override the param.
@value interface Base {
call<#x> (#x) -> ()
}
concrete Child<#x> {
refines Base
// call also has param #x.
}
In this case, Child<Foo>
sets the arg type for call
to Foo
.
It seems like there are two options here:
Child.call
. This could be tedious if the function has filters.Map
itself.As it turns out, the example above fails when validating Child
(suggestion 1 above); however, the context of the error is Base.call
rather than Child.call
.
So, the clash won't actually happen, but the error currently points to the wrong place.
Leaving this open and changing the type from "bug" to "enhancement" to implement suggestion 2 above. (Use a category vs. function enum during the separate substitution stages.)
Suggestion 2 won't work because the function can't actually be defined if it has a parameter clash. So, the only choice here is to make the error message more clear.
The following causes the error:
One potential solution is to somehow mark a param as "resolved". For example, add a flag to
JustParamName
that gets set when substitution happens inuncheckedSubInstance
. (Then also get rid ofweakGetValueForParam
.)