Skip to content

Tuple index access in lambda creates incorrect type #9210

@ennisj9

Description

@ennisj9

Zig compiler:

Minimum reproduction

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.6/2BfGn4M9uWJNhDVeMghGeXNVDFijMfPsmmVeo6M4QjKX.tar.zst" }

import pf.Stdout

first_of_tuple = |tup| tup.0

main! = |_args| {
    tup = ("first","last")
    Stdout.line!(first_of_tuple(tup))
    Ok({})
}

Result

-- TYPE MISMATCH ---------------------------------

The first argument being passed to this function has the wrong type:
  ┌─ main.roc:9:18
  │
9 │     Stdout.line!(first_of_tuple(tup))
  │                                 ^^^

This argument has the type:

    (Str, Str)

But first_of_tuple needs the first argument to be:

    (_field)

Found 1 error(s) and 0 warning(s) for main.roc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions