Skip to content

An error due to 20-length integer constant #2553

Open
@zzctmac

Description

@zzctmac

Here is my code:

{-# OPTIONS_GHC -fplugin=LiquidHaskell #-}

module IntByteArray where

main :: IO ()
main = return ()

{-@ always_true1 :: (n:Integer) -> {y:Bool|y} @-}
always_true1 :: Integer -> Bool
always_true1 n = n > 11446744073709551616 || n <= 11446744073709551616
> runghc Bi.hs
**** LIQUID: ERROR: Bi.hs:14:1-14:13: Error
  elaborate solver elabBE 122 "lq_anf$##7205759403792797694##d142" {lq_tmp$x##599 : GHC.Prim.ByteArray# | [(lq_tmp$x##599 =
                                           11446744073709551616)]} failed on:
      lq_tmp$x##599 == 11446744073709551616
  with error
      The sort GHC.Prim.ByteArray# is not numeric
  because
Cannot unify GHC.Prim.ByteArray# with int in expression: lq_tmp$x##599 == 11446744073709551616
  because
Elaborate fails on lq_tmp$x##599 == 11446744073709551616
  in environment
      lq_tmp$x##599 := GHC.Prim.ByteArray#
Bi.hs:14:1: error:
    Uh oh.
    elaborate solver elabBE 122 "lq_anf$##7205759403792797694##d142" {lq_tmp$x##599 : GHC.Prim.ByteArray# | [(lq_tmp$x##599 =
                                               11446744073709551616)]} failed on:
        lq_tmp$x##599 == 11446744073709551616
    with error
        The sort GHC.Prim.ByteArray# is not numeric
      because
    Cannot unify GHC.Prim.ByteArray# with int in expression: lq_tmp$x##599 == 11446744073709551616
      because
    Elaborate fails on lq_tmp$x##599 == 11446744073709551616
    in environment
        lq_tmp$x##599 := GHC.Prim.ByteArray#
   |
14 | always_true1 n = n > 11446744073709551616 || n <= 11446744073709551616
   | ^

After change from 11446744073709551616 to 1446744073709551616 (20-length to 19-length)

{-# OPTIONS_GHC -fplugin=LiquidHaskell #-}

module IntByteArray where

main :: IO ()
main = return ()

{-@ always_true0 :: (n:Integer) -> {y:Bool|y} @-}
always_true0 :: Integer -> Bool
always_true0 n = n > 1446744073709551616 || n <= 1446744073709551616
> runghc Bi.hs
**** LIQUID: SAFE (2 constraints checked) **************************************

Haskell Version: 9.12.2
LiquidHaskell Version: 0.9.12.2

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