Closed crusso closed 3 years ago
Claudio: I'm not really sure I can better using just local inference though...
Christoph Hegemann : Could this be worth special casing like "applying a non-function type"? Hinting the user that omitting type parameters on constructors defaults them to None?
Maybe the simple solution is to just warn if inference defaults a type argument to None? In the rare case where it's actually intended, devs can shut up the warning by making the type explicit (which probably helps readability as well).
Actually we might be able to do better. I think the problem here I that A in Buf invariant so any underdetermined choice is not minimal/principal thus bad. Will need to look at the algorithm again.
Is this still a problem? Care to commit a test case that exhibits the bad error message, so that it’s clear whether/when this is fixed?
Does https://github.com/dfinity/motoko/pull/2149 look good?
Perfect, thanks
Christoph says:
Oh, I don't like that omitting a type parameter defaults it to None... chasing that one down was a pain Eg.
If you omit the
<A>
on the buffer constructor you get a failure about mismatch between A and None at the buffer.add call.