Skip to content

Reflection doesn't behave as measures #2582

@pacastega

Description

@pacastega

The function inferType below can be declared as a measure, which makes both foo and bar pass. When declaring it as reflect only foo passes. Enabling --ple-with-undecided-guards makes both pass again.

{-@ LIQUID "--reflection" @-}
{-@ LIQUID "--ple" @-}
-- {-@ LIQUID "--ple-with-undecided-guards" @-}
module Test where

data Ty = TInt | TBool
data Expr = CONST Int | TRUE | FALSE

{-@ reflect inferType @-}
-- {-@ measure inferType @-}

inferType :: Expr -> Ty
inferType (CONST _) = TInt
inferType TRUE = TBool
inferType FALSE = TBool

{-@ type IntExpr = {e:Expr | inferType e = TInt} @-}

-- passes
{-@ foo :: IntExpr @-}
foo :: Expr
foo = CONST 42

-- fails
{-@ bar :: [IntExpr] @-}
bar :: [Expr]
bar = [CONST 42]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions