Skip to content

Inconsistent type inference #1592

@lovettchris

Description

@lovettchris

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

This function:

def foo (a : Nat) (b)  := a + b

resolves to foo : Nat → Nat → Nat

But this one does not:

def foo (a : Nat) (b) : Nat := a + b

saying failed to infer binder type when the resulting type of a declaration is explicitly provided, all holes (e.g., _) in the header are resolved before the declaration body is processed

Steps to Reproduce

See above.

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

Lean (version 4.0.0-nightly-2022-09-12, commit ec2372e, Release)

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-mediumWe may work on this issue if we find the time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions