Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions with forward-declared data as an argument incorrectly accepted as covering #3457

Open
dunhamsteve opened this issue Dec 30, 2024 · 0 comments

Comments

@dunhamsteve
Copy link
Collaborator

Coverage checking appears to be broken when a forward declared data type is involved.

Steps to Reproduce

data Three = A | B | C
data Bar : Type
data Foo : Type where
  MkFoo : Three -> Bar -> Foo

fun : Foo -> String
fun (MkFoo A y) = ""
fun (MkFoo B y) = ""

data Bar : Type where
  MkBar : Bar

Expected Behavior

I expect Idris to call out the missing case of C in fun or complain that Bar hasn't been defined yet when checking fun.

What would be the ideal behavior in this case? Ignore the y slot and call out the missing C or make it an error to have undefined types when building case trees?

Observed Behavior

The function fun is accepted as covering, despite missing the C case. I believe it's deciding that case is impossible because one of the pattern variables doesn't have a valid constructor. Failing to distinguish between empty and no constructors defined yet.

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

No branches or pull requests

2 participants