Skip to content

Higher-order argument modes generate contradictory compile errors #2721

Closed

Description

@bblum

error: mismatched types: expected fn@(&&<V1>) but found native fn(str) (expected argument mode ++ but found &&)

This arose when passing a fn(str) as an argument to a function expecting fn@(T). No explicit argument mode annotation was used.

note the contradiction: "expected ..&&.." at first followed by "expected ..++.." later. Patrick seems to think they must be referring to the same thing (the argument of the function being passed) because it wouldn't come up without higher-order arguments.

Activity

  1. catamorphism commented on Jun 26, 2012

    @catamorphism
    Contributor

    This problem will hopefully go away when argument modes go away, which is hopefully soon.

  2. bblum commented on Jun 26, 2012

    @bblum
    ContributorAuthor

    hopefully!

    in the meantime i will also note that it appears to simply have it backwards. changing the fn(str) to fn(-str) produces:

    error: mismatched types: expected fn@(&&uint) but found native fn(-<V10>) (expected argument mode - but found &&)

  3. catamorphism commented on Jun 28, 2012

    @catamorphism
    Contributor

    Yeah, those "backwards" errors are endemic in typeck -- keep reporting them.

  4. catamorphism commented on Jun 28, 2012

    @catamorphism
    Contributor

    (marking as "postponed" since we can probably close this when argument modes go away)

  5. kud1ing commented on Jun 29, 2012

    @kud1ing

    Is there a "remove argument mode" issue to link this issue to? Also #2585 is waiting for this.

  6. nikomatsakis commented on Jul 5, 2012

    @nikomatsakis
    Contributor

    The fix is to modify infer to track which value comes "from the user" and which does not.

  7. nikomatsakis commented on Jul 5, 2012

    @nikomatsakis
    Contributor

    I think I opened an issue for this... I'll search and open one if not. Or maybe just fix it. It's just some tedious work.

  8. nikomatsakis commented on Jul 5, 2012

    @nikomatsakis
    Contributor

    closing as a dup of #2806.

  9. added a commit that references this issue on Dec 24, 2022
  10. added a commit that references this issue on Jan 6, 2023
  11. added a commit that references this issue on Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions