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

Parser: remove obsolete handling of else inside lib struct #13028

Merged

Conversation

HertzDevil
Copy link
Contributor

A long time ago, ifdef and else used to be special keywords inside lib structs and unions:

lib LibC
  struct Foo
    ifdef some_flag
      a : Int32
    else
      a : Float64
    end
  end
end

Today the above would be written as:

lib LibC
  struct Foo
    {% if flag?(:some_flag) %}
      a : Int32
    {% else %}
      a : Float64
    {% end %}
  end
end

So the handling for the else keyword in this context can be dropped. This doesn't affect the parser, but it does expose a syntax error in the top-level phase (detected only after macro interpolation) to the formatter.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:tools:formatter topic:compiler:parser labels Jan 29, 2023
@straight-shoota straight-shoota added this to the 1.8.0 milestone Jan 29, 2023
@straight-shoota straight-shoota merged commit f33b5fc into crystal-lang:master Jan 30, 2023
@HertzDevil HertzDevil deleted the refactor/lib-struct-body-else branch January 30, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:parser topic:tools:formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants