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

Newtype/enum expression causes core lint to panic #1617

Closed
RyanGlScott opened this issue Jan 26, 2024 · 3 comments
Closed

Newtype/enum expression causes core lint to panic #1617

RyanGlScott opened this issue Jan 26, 2024 · 3 comments
Assignees
Labels
bug Something not working correctly enums Issues related to enums

Comments

@RyanGlScott
Copy link
Contributor

RyanGlScott commented Jan 26, 2024

// Bar.cry
newtype T = { unT : [8] }

f : T
f = T { unT = 0 }
// Bar.icry
:set coreLint=true
:l Bar.cry
$ ~/Software/cryptol-3.0.0/bin/cryptol -b Bar.icry 
Loading module Cryptol
Loading module Cryptol
{n, a, b, c} n == min n n
{a, n} (fin n) => inf == inf * (1 * (1 * 1))
{a, n} (fin n) => n / 2 == n - n /^ 2
{n, a, b} n == min n n
{n} (n >= 1, fin n) => (fin n, n >= 1)
Loading module Main
cryptol: You have encountered a bug in Cryptol's implementation.
*** Please create an issue at https://github.com/GaloisInc/cryptol/issues

%< --------------------------------------------------- 
  Revision:  7aede559ad102b0ccdaf4b377d3fa17cc564286e
  Branch:    release-3.0.0 (uncommited files present)
  Location:  Core lint failed:
  Message:   Location: Bar.cry:5:5--5:6
             Undefined variable
  • Variable: Main::T
CallStack (from HasCallStack):
  panic, called at src/Cryptol/Utils/Panic.hs:21:9 in cryptol-3.0.0-inplace:Cryptol.Utils.Panic
  panic, called at src/Cryptol/ModuleSystem/Base.hs:717:29 in cryptol-3.0.0-inplace:Cryptol.ModuleSystem.Base
%< ---------------------------------------------------

A similar issue exists for enum constructors on the sum-types (#1602) as well:

// Foo.cry
enum T = MkT

f : T
f = MkT
// Foo.icry
:set coreLint=true
:l Foo.cry
$ cabal run exe:cryptol -- -b Foo.icry 
Loading module Cryptol
Loading module Cryptol
{n, a, b, c} n == min n n
{a, n} (fin n) => inf == inf * (1 * (1 * 1))
{a, n} (fin n) => n / 2 == n - n /^ 2
{n, a, b} n == min n n
{n} (n >= 1, fin n) => (fin n, n >= 1)
Loading module Main
cryptol: You have encountered a bug in Cryptol's implementation.
*** Please create an issue at https://github.com/GaloisInc/cryptol/issues

%< --------------------------------------------------- 
  Revision:  a6b48b41d54798ea376d26255ad315178752ab93
  Branch:    sum-types (uncommited files present)
  Location:  Core lint failed:
  Message:   Location: Foo.cry:5:5--5:8
             Undefined variable
  • Variable: Main::MkT
CallStack (from HasCallStack):
  panic, called at src/Cryptol/Utils/Panic.hs:21:9 in cryptol-3.0.0.99-inplace:Cryptol.Utils.Panic
  panic, called at src/Cryptol/ModuleSystem/Base.hs:732:29 in cryptol-3.0.0.99-inplace:Cryptol.ModuleSystem.Base
%< ---------------------------------------------------
@RyanGlScott RyanGlScott added bug Something not working correctly enums Issues related to enums labels Jan 26, 2024
@RyanGlScott RyanGlScott changed the title Newtype expression causes core lint to panic Newtype/enum expression causes core lint to panic Jan 26, 2024
@yav
Copy link
Member

yav commented Jan 29, 2024

That's likely because we need to fill in the missing bit in Sanity

@RyanGlScott
Copy link
Contributor Author

Which missing bit are you referring to? I think this issue is separate from #1615 since it affects newtypes, not just enums.

@yav yav self-assigned this Jan 31, 2024
@yav
Copy link
Member

yav commented Jan 31, 2024

You are correct---the issue that we are not adding the types of constructors to the environment. I am in the process of fixing it.

yav added a commit that referenced this issue Jan 31, 2024
@yav yav closed this as completed Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something not working correctly enums Issues related to enums
Projects
None yet
Development

No branches or pull requests

2 participants