8000 Dargent ignores field if not in layout. · Issue #311 · au-ts/cogent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Dargent ignores field if not in layout. 8000 #311

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

Open
gteege opened this issue Nov 12, 2019 · 1 comment
Open

Dargent ignores field if not in layout. #311

gteege opened this issue Nov 12, 2019 · 1 comment

Comments

@gteege
Copy link
Contributor
gteege commented Nov 12, 2019

The code

type R = {a: U32, b: U32} layout record {a: 4B at 0B }
f: R -> R
f x = x{a=5}

compiles successfully but creates a C datatype

struct t1 { unsigned int data[1U]; } ;

i.e., the b field is silently ignored.
When the field is used afterwards, the compiler crashes:

type R = {a: U32, b: U32} layout record {a: 4B at 0B }
f: R -> R
f x = x{a=5,b=7}

causes the error message

cogent -g put-nonlayout-field.cogent 
Parsing...
Resolving dependencies...
Typechecking...
Desugaring and typing...
Normalising...ANF
Re-typing NF...
Simplifying...
Skipped
Monomorphising...
Re-typing monomorphic AST...
Generating C code...
  > Writing to file: ./put-nonlayout-field.h
cogent: Map.!: given key is not an element in the map
CallStack (from HasCallStack):
  error, called at libraries/containers/Data/Map/Internal.hs:610:17 in containers-0.6.0.1:Data.Map.Internal
@zilinc
Copy link
zilinc commented Nov 12, 2019

@ccapitalK Your implementation should fix this, right?

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

3 participants
0