type alias Base other =
{ other | base : () }
type alias Specific other =
Base { other | extra : () }
extra : Base (Specific other) -> ()
extra specificArgument =
specificArgument.extra
specific : Base { extra : () }
specific =
{ base = ()
, extra = ()
}
specificExtra =
extra specific
elm complains
-- TYPE MISMATCH -------------------------------------------------- src/Bug.elm
The 1st argument to `extra` is not what I expect:
25| extra specific
^^^^^^^^
This `specific` value is a:
Base { extra : () }
But `extra` needs the 1st argument to be:
Base (Specific other)
Hint: Seems like a record field typo. Maybe base should be extra?
Hint: Can more type annotations be added? Type annotations always help me give
more specific messages, and I think they could help a lot in this case!
Any other combination of types (and no types) for extra and specific I've tried do not lead to this problem.
In this example of correct elm code
elm complains
Any other combination of types (and no types) for
extra
andspecific
I've tried do not lead to this problem.Additional Details
Popped up while refactoring the type properties in https://github.com/jfmengels/elm-review-simplify
https://github.com/elm/compiler/issues/2298 might be related.