Skip to content

Type-checker fails unification unexpectedly for auto-implicit type #1875

Description

@DrBearhands

Came across a situation I believe to be a bug, but might be my own error.

Steps to Reproduce

module Main

data PostS : (valType : Type) -> (stateType : Type) -> (valType -> stateType -> Type) -> Type where
  MkPostS
    :  (val : valType)
    -> (outState : stateType)
    -> {auto 0 prf : prop val outState}
    -> PostS valType stateType prop


data Foo = Bar | Baz

f : PostS Foo Foo Equal
f = MkPostS Bar Bar

Also asked on stackoverflow as I thought it may be my own error: https://stackoverflow.com/questions/68953988/idris2-compiler-tries-to-unify-type-values-unexpectedly

Expected Behavior

Compilation succeeds.

Observed Behavior

Error(s) building file [...]: While processing right hand side of f. When unifying Baz and Bar.
Mismatch between: Baz and Bar.

tests.HoareMonad2:14:5--14:20
 10 | 
 11 | data Foo = Bar | Baz
 12 | 
 13 | f : PostS Foo Foo (Equal)
 14 | f = MkPostS Bar Bar
          ^^^^^^^^^^^^^^^

MkPostS Baz Baz compiles correctly, as does MkPostS{prf=Refl} Bar Bar. Combinations of Bar and Baz correctly fail (even if given {prf=Refl}).

When replacing Foo with Nat, the value passed to MkPostS attempts (and fails to) match on 0.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions