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

Parsing failure with preocessor expressions #341

Closed
WillLillis opened this issue Jul 3, 2024 · 1 comment
Closed

Parsing failure with preocessor expressions #341

WillLillis opened this issue Jul 3, 2024 · 1 comment

Comments

@WillLillis
Copy link
Member

WillLillis commented Jul 3, 2024

After CI failed in #340, I found that a new file had been added to the example set since the last run, which fails to parse. I tried cutting it down to the following minimal example:

#if NETFRAMEWORK
    foo()
#else
#pragma warning disable CS0618
#endif

Parsing output:

(compilation_unit [0, 0] - [5, 0]
  (ERROR [0, 0] - [4, 6]
    (preproc_if [0, 0] - [4, 6]
      condition: (identifier [0, 4] - [0, 16])
      (invocation_expression [1, 4] - [1, 9]
        function: (identifier [1, 4] - [1, 7])
        arguments: (argument_list [1, 7] - [1, 9]))
      alternative: (preproc_else [2, 0] - [2, 5])
      (preproc_pragma [3, 0] - [4, 0]
        (identifier [3, 24] - [3, 30])))))
minimal.cs    0.20 ms         349 bytes/ms (ERROR [0, 0] - [4, 6])

For good measure, here is the relevant section and parsing output for the failed parse of the full file as well:

(ERROR [346, 0] - [352, 6]
  (array_type [346, 4] - [350, 28]
    type: (array_type [346, 4] - [347, 28]
      type: (identifier [346, 4] - [346, 16])
      rank: (array_rank_specifier [347, 12] - [347, 28]
        (invocation_expression [347, 13] - [347, 27]
          function: (identifier [347, 13] - [347, 20])
          arguments: (argument_list [347, 20] - [347, 27]
            (argument [347, 21] - [347, 26]
              (integer_literal [347, 21] - [347, 26]))))))
    (comment [347, 29] - [347, 56])
    (ERROR [348, 0] - [348, 5])
    (preproc_pragma [349, 0] - [350, 0]
      (identifier [349, 24] - [349, 30]))
    rank: (array_rank_specifier [350, 12] - [350, 28]
      (invocation_expression [350, 13] - [350, 27]
        function: (identifier [350, 13] - [350, 20])
        arguments: (argument_list [350, 20] - [350, 27]
          (argument [350, 21] - [350, 26]
            (integer_literal [350, 21] - [350, 26]))))))
  (comment [350, 29] - [350, 56])
  (preproc_pragma [351, 0] - [352, 0]
    (identifier [351, 24] - [351, 30])))
...
#if NETFRAMEWORK
            [Timeout(2_000)] // Ok status will be Passedz
#else
#pragma warning disable CS0618
            [Timeout(2_000)] // Ok status will be Passed
#pragma warning restore CS0618
#endif
...
@amaanq
Copy link
Member

amaanq commented Jul 4, 2024

yeah this is intentional in order to have more structured parsing for the majority of preproc defs, it should just be added to the ci list of failing files, which I have done now, sorry for the delay

@amaanq amaanq closed this as completed Jul 4, 2024
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

No branches or pull requests

2 participants