Skip to content

Conversation

@jiribenes
Copy link
Contributor

@jiribenes jiribenes commented Nov 27, 2025

Resolves #668

Continues on from #1205 by having a much more structured representation: instead of just numbers, we actually align the two argument lists, seeing what's in both, what's only expected, and what's only received.

Then once we have the information, we can (very hackily!) resolve #668 by providing slightly more specialised messages when argument lists and tuples are mismatched. Note that this message is only shown somewhat conservatively: only if the swap for a tuple could work based on the arg count!

Screenshot 2025-11-27 at 16 11 49 Screenshot 2025-11-27 at 16 12 37 Screenshot 2025-11-27 at 16 12 16 Screenshot 2025-11-27 at 16 46 54

I think that all of these could eventually have quick fixes attached to them :)

(values.matched, values.extra, values.missing) match {
case (List((arg: source.ValueArg, _)), Nil, missing@(_ :: _)) =>
(arg.value, name) match {
case (source.Call(source.IdTarget(source.IdRef(List("effekt"), tupleName, _)), _, tupleArgs, _, _), Some(givenName))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Polymorphism boxing used to use findPrelude to find these more precisely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nicer error messages on argument list / tuple mismatch

3 participants