brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 110 forks source link

type-check internal error #1422

Open buster-blue opened 6 years ago

buster-blue commented 6 years ago

When I run the following code in type-check mode of the online editor:

songs = table: title, artist, play-count
  row: "Song 1", "Artist A", 11
  row: "Song 2", "Artist B", 22
  row: "Song 3", "Artist C", 33
end

ab-songs = sieve songs using artist:
  artist == "Artist B"
end
order ab-songs:
  play-count ascending
end

I consistently get this message, instead of a typical result:

Internal errors prevented this error message from being shown. Please report this as a bug.

This code works without errors, including the usual type, when I run it in non type-check mode. I have commented-out code in the file too, but removing it didn't change the results.

blerner commented 6 years ago

The "internal error" complaint is either an error-messages problem or a desugaring problem. Specifically, desugar.arr introduces prim-app calls to checkWrapTable, which use the same srcloc as the table identifier inside it. Then compile-structs, line 1112, dies because it's expecting an s-id, but gets an s-prim-app.

I'm not sure why there's an unbound-id error even being thrown, though, so there's a second problem at work, after this internal error is fixed.