rbs icon indicating copy to clipboard operation
rbs copied to clipboard

Implement context validation on parse

Open ksss opened this issue 9 months ago • 3 comments

Contextual limitations are now performed at parse time.

This change was originally planned for version 3.4 but remained unaddressed.

We plan to change the parser to reject those types if it breaks the contextual limitations in next release -- 3.4.

I propose introducing it with the release of version 4.0.

Changes

  • The check will only be performed in Parser.parse_signature.
  • RBS::UnitTest, they have not been removed in this PR.
  • Deprecate --[no-]exit-error-on-syntax-error option.
  • Raise RBS::ParsingError instead of RBS::WillSyntaxError.
  • Remove RBS::WillSyntaxError.
  • Contextual limitations checks in the rbs validate command have been stopped.
  • Gave up analyzing CONST: self in the rbs prototype rb.

Not changes

  • I have not changed that RBS::ParsingError is raised for compatibility with Steep. It may be possible to use a different error name.
  • Parser.parse_type and Parser.parse_method_type do not currently perform checks. It might be worth adding them.
  • Since has_self_type?, has_classish_type?, and with_nonreturn_void? are used in RBS::UnitTest, they have not been removed in this PR.

ksss avatar Mar 18 '25 14:03 ksss

Rebased on master.

ksss avatar May 23 '25 00:05 ksss

Thank you for reviewing. I'll fix soon.

ksss avatar May 27 '25 07:05 ksss

I only renamed rbs_type_validation_t to rbs_type_parsing_option_t.

ksss avatar May 27 '25 14:05 ksss