mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
8edd23459d
## Summary - Pass the definite-assignment assertion token offset through the class accessor-property parser path. - Report invalid ambient and abstract `accessor prop!` diagnostics on the `!` token, matching the span behavior used by variable declarators and normal class properties. - Add focused misc parser coverage for the accessor-specific invalid cases. ## Rationale This follows up #23170. That parser change already narrowed definite-assignment diagnostics for variables and normal class properties, but accessor properties still kept only a boolean. That meant `accessor prop!` could only report TS1255 using the full class element span. Carrying the offset into `parse_class_accessor_property` aligns accessor diagnostics with the other definite-assignment diagnostics and keeps the AST shape unchanged by storing only `definite.is_some()`. The misc fixture is needed because upstream TypeScript coverage exercises invalid definite assertions on normal fields, but not invalid accessor properties. Existing misc coverage only had a valid `accessor y!` pass case, so `just coverage` did not specifically protect the accessor diagnostic span this fixes.
8 lines
132 B
TypeScript
8 lines
132 B
TypeScript
declare class AmbientAccessor {
|
|
accessor prop!: string;
|
|
}
|
|
|
|
abstract class AbstractAccessor {
|
|
abstract accessor prop!: string;
|
|
}
|