Skip to content

Conversation

@kaankacar
Copy link

Prohibit combined unary operators

  • Add semantic error for chained/unparenthesized unary combinations (including parenthesized and negative-literal operands).
  • Update unary/coverage tests to expect errors for sequences like --x, -~x, !!x.

Fixes #82

@0xGeorgii
Copy link
Contributor

@kaankacar Thanks for the contribution. I think that because this check is scope-bounded and not actually a type-check, rather a semantic check, it makes sense to create a new core crate semantic-analysis so the high-level data flow should be like:

parse -> type check -> semantic check -> codegen ...

And there is actually a placeholder function for invoking this new crate:

https://github.com/Inferara/inference/blob/main/core/inference/src/lib.rs#L330

Also, how about parenthesized expressions such as -(~x)) etc.

Since we need to have 3 categories of reporting (info, warning, error), this should also be properly sorted out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combined unary operators are prohibited (-~x)

2 participants