Give more graceful error message when compiling Array 0
to C99?
#649
RyanGlScott
started this conversation in
General
Replies: 1 comment 4 replies
-
What module would that be in? Should we make it part of: |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It is possible to define a Copilot
Array
of length0
. For example:This is a bit weird, as you can't really do much with the resulting array (for instance, you can't index into it), but this is nevertheless a legal stream definition in Copilot. In fact, you can compile this to Bluespec and simulate it:
Interestingly, if you replace the
import Copilot.Compile.Bluespec
line withimport Copilot.Compile.C99
, then Copilot crashes outright if you try to compile it:I don't believe that C99 permits empty arrays, so it is somewhat understandable that Copilot would reject this program. Still, it would be nicer if Copilot threw a proper error message here rather than crashing with a generic
NonEmpty.fromList: empty list
error, which leakscopilot-c99
's internals.Beta Was this translation helpful? Give feedback.
All reactions