Indeed.  It's not clear how much work it is worth doing to discover that the reason _why_ we're in the remainder is that we had a pattern:

    case Foo(Bar(Baz(Mumble(Soup s)))):

and someone passed us a Foo(Bar(Baz(Mumble(pizza)))).

We could statically emit a description of the remainder, but it would get large and esoteric quickly if pattern nesting got "deep" or "wide".  Seems mostly like an ugly secret the compiler should keep to itself.


On 4/29/2021 10:48 AM, Maurizio Cimadamore wrote:


On 29/04/2021 15:46, Brian Goetz wrote:
I don't think we want the compiler generating tons of code just so each remainder can get a different exception; more likely, the compiler will want to generate some sort of "default: throwSomethingSimple" clause.

Yeah - that's my understanding, as far as code generation goes.

I guess an interesting question, for when we generate better error messages to show remainder, would be how to "spell" (e.g. in the diagnostic) those remainders associated with not-yet known types.

But that's a question for another day.

Maurizio


Reply via email to