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

Order of constructor arguments matters for coverage checker #1384

Closed
GoogleCodeExporter opened this issue Aug 8, 2015 · 3 comments
Closed
Labels
coverage Pattern-matching coverage checker status: already-fixed type: bug Issues and pull requests about actual bugs
Milestone

Comments

@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Aug 8, 2015

-- Current Agda master.

{-# OPTIONS --no-coverage #-}
{-# OPTIONS -v tc.cover:20 #-}

open import Common.Bool
open import Common.Equality

_∨_ : Bool  Bool  Bool
a ∨ b = if a then true else b

module Works where
  data Term : Bool  Set where
    I   : Term false
    App :  a b c  a ∨ b ≡ c  Term a  Term b  Term c

  -- The following clause works for the coverage checker:

  test : Term false  Set
  test (App false false .false refl I x) = Bool

module Fails where

  data Term : Bool -> Set where
    I   : Term false
    App :  a b c  Term a  Term b  a ∨ b ≡ c  Term c

  -- If we put the equality proof later in App, it fails:

  test : Term false  Set
  test (App false false .false I x refl) = Bool
  -- The following checks, until you split at p.
  -- test (App false false .false I x p) = {!p!}

See also issue #408.

Original issue reported on code.google.com by andreas....@gmail.com on 6 Dec 2014 at 12:13

@GoogleCodeExporter GoogleCodeExporter added type: bug Issues and pull requests about actual bugs auto-migrated coverage Pattern-matching coverage checker labels Aug 8, 2015
@GoogleCodeExporter
Copy link
Author

GoogleCodeExporter commented Aug 8, 2015

Should it be possible to help Agda choose the argument splitting order?

I mean something similar to inferring arguments using dot pattern. So, when checker sees such pattern it doesn't try to split on the argument the
pattern is applied to.

Original comment by d.staro...@gmail.com on 7 Dec 2014 at 12:46

@UlfNorell
Copy link
Member

This seems to be working now, although I have a bit of a hard time figuring out the expected behaviour due to --no-coverage.

asr added a commit that referenced this issue May 28, 2018
asr added a commit that referenced this issue May 28, 2018
(cherry picked from commit 90dff71 for #2875)
@asr asr added this to the 2.5.4 milestone May 28, 2018
@asr
Copy link
Member

asr commented May 28, 2018

I added the above test case to the release-2.5.4 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coverage Pattern-matching coverage checker status: already-fixed type: bug Issues and pull requests about actual bugs
Projects
None yet
Development

No branches or pull requests

3 participants