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

Surprising "auto cannot be used for variable declaration" #1792

Closed
awelzel opened this issue Jul 11, 2024 · 2 comments · Fixed by #1889
Closed

Surprising "auto cannot be used for variable declaration" #1792

awelzel opened this issue Jul 11, 2024 · 2 comments · Fixed by #1889

Comments

@awelzel
Copy link
Contributor

awelzel commented Jul 11, 2024

Slight duplicate of #1790, but I was surprised by the "type 'auto' cannot be used for variable declaration" - is that needed/useful?

$ cat strange.spicy 
module Test;

type T = unit() {
  x: uint8;
};

public type U = unit() {
  len: uint32;

  ts: T[] &size=self.len {
    for ( e in self.tss )  # typoed and should just be $$
      print e.x;
  }
};
$ spicyc -j strange.spicy -o /tmp/x.hlto
[error] strange.spicy:11:5-12:16: type 'auto' cannot be used for variable declaration
[error] strange.spicy:11:16-11:23: unsupported operator: <Test::U>.tss
[error] strange.spicy:12:13-12:15: unsupported operator: <auto>.x
[error] spicyc: aborting after errors
@rsmmr
Copy link
Member

rsmmr commented Jul 12, 2024

It's a prioritization issue in the output: the right error is the 2nd (modulo #1790), the 1st and 3rd are follow-ups that would better be suppressed (which is possible, just needs a bit of additional logic in the validator).

@bbannier
Copy link
Member

Similar to #1790, marking this as a regression since before #1462 we would have reported

[error] foo.spicy:11:19-11:26: type does not have field 'tss'
[error] foo.spicy:12:19-12:19: unknown ID 'e'
[error] spicyc: aborting after errors

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.

3 participants