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

Error in generated code for self.position().offset() #1508

Closed
bbannier opened this issue Aug 28, 2023 · 0 comments · Fixed by #1509
Closed

Error in generated code for self.position().offset() #1508

bbannier opened this issue Aug 28, 2023 · 0 comments · Fixed by #1509
Assignees

Comments

@bbannier
Copy link
Member

I would expect the following to generate code printing the offset of the unit field, but it looks like invalid code is generated so this does not compile

module foo;

public type X = unit {
    : uint8 { print self.position().offset(); }
};
$ spicyc -j foo.spicy
/private/var/folders/ht/vtb0rkbd4ws15vx02xdb84zw0000gn/T/foo_4401a488ba3fc7e5-8f847f58a5b1b22b.cc:322:44: error: no member named 'offset' in 'std::optional<hilti::rt::stream::SafeConstIterator>'; did you mean to use '->' instead of '.'?
    ::hilti::rt::print((*__self).__position.offset(), ::hilti::rt::Bool(true));
                                           ^
                                           ->
1 error generated.
[error] spicy-driver: JIT compilation failed
@bbannier bbannier self-assigned this Aug 28, 2023
bbannier added a commit that referenced this issue Aug 28, 2023
We declared this member to return an iterator, but potentially returned
an optional iterator. This patch add an additional deref so we get the
correct value.

Closes #1508.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant