asoffer / Icarus

An experimental general-purpose programming language
Apache License 2.0
9 stars 2 forks source link

Cross-module struct field access is broken #105

Closed perimosocordiae closed 2 years ago

perimosocordiae commented 2 years ago

This one only appears when accessing an exported struct field from another module. To reproduce, you'll need two files. First, the library module, call it "lib.ic":

#{export}
foo ::= struct {
  #{export}
  length: u64
}

#{export}
make ::= (len: u64) -> foo {
  return foo.{ length = len }
}

And then the main file:

lib ::= import "lib.ic"
x := lib.make(10)
n := x.length

Running this results in a crash:

[139710557980488 compiler/verify/access.cc:327 operator()] data.context().AstLiteral(s) is unexpectedly null.
*** SIGABRT received at time=1641821701 on cpu 3 ***
PC: @     0x7f10e637f808  (unknown)  pthread_kill
    @          0x184e180         64  absl::WriteFailureInfo()
    @          0x184de64        224  absl::AbslFailureSignalHandler()
    @     0x7f10e632b520  (unknown)  (unknown)
Aborted (core dumped)