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

Type coercion failure when trying to &parse-from with begin(some_stream) #1524

Open
bbannier opened this issue Sep 11, 2023 · 1 comment
Open

Comments

@bbannier
Copy link
Contributor

While looking for a workaround for #1523 I ran into a type coercion failure I did not expect.

module foo;

global s = stream(b"\x00\x01\x02");

public type X = unit {
    x: uint8 &parse-from=begin(s);
};
$ spicyc -d foo.spicy
[error] foo.spicy:6:17-9:2: cannot coerce expression 'begin(foo::s)' of type 'iterator<stream>' to type 'value_ref<stream>'
[error] spicy-dump: aborting after errors

Here begin(s) should return an iterator<stream> which according to the docs can be passed to &parse-at.

@bbannier
Copy link
Contributor Author

This should probably be rejected since &parse-from only accepts bytes.

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

1 participant