Function types lose the arity of a single tuple parameter

Open
#611 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
haskell
Domain
compilers

Research direction

Start by reading ReplaceFunTypeArgs.replace and its use of tupleTyFromList, then trace how application lowering packs call arguments. Reproduce the issue with the provided function and compare f(x, y) with f((x, y)). Done means the first call is rejected and the tuple call is accepted with specialization disabled and legacy typeclass resolution.

Written by the indexing model from the issue text.

Description

With specialization disabled, the frontend with legacy typeclass resolution accepts two separate arguments for a function type that explicitly takes one (word, word) tuple argument.

function apply(f: function((word, word)) returns (word), x: word, y: word) returns (word) {
    return f(x, y);
}

Actual: The frontend exits successfully with no diagnostic.

Expected: Reject f(x, y) for this explicit one-parameter function type; f((x, y)) should be accepted.

ReplaceFunTypeArgs.replace packs the parameter list with tupleTyFromList. Its singleton case makes one tuple parameter indistinguishable from two separate parameters. Application lowering similarly packs call arguments.

Dominant language
Haskell
Stars
115
Forks
11
Avg merge
20h 29m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from argotorg/solcore

All issues in argotorg/solcore

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.