From 1b072fed0e064b922d20b2507928dfe23e99f868 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 23 May 2025 13:57:51 -0700 Subject: [PATCH 1/4] Add the 5 modifier tags: `@public @private @protected @readonly @override` Three notes: - I did not add support for BinaryExpressions yet because they don't have a Modifiers list. I think the right thing is to add it (along with a Type node), but I want to bring it up at a design meeting first. - I dropped the error messages with tag-specific wording for `@override`. This seems unnecessary to me -- people who use JS as TS are aware that's what they're doing. - I added a setModifiers method on nodeData and exposed it via a public AsMutable method on Node. I don't know if that's exactly the right way to do it. --- internal/ast/ast.go | 14 ++- internal/checker/grammarchecks.go | 38 +++--- internal/parser/reparser.go | 69 ++++++++--- .../jsdocAccessibilityTags.errors.txt | 80 ++++++++++++ .../conformance/jsdocOverrideTag1.errors.txt | 11 +- .../conformance/jsdocReadonly.errors.txt | 30 +++++ .../submodule/conformance/jsdocReadonly.types | 12 +- .../jsdocReadonlyDeclarations.types | 10 +- .../conformance/override_js1.errors.txt | 14 ++- .../conformance/override_js2.errors.txt | 14 ++- .../conformance/override_js3.errors.txt | 17 --- .../conformance/override_js4.errors.txt | 15 +++ ...ateNamesIncompatibleModifiersJs.errors.txt | 110 +++++++++++++++++ .../uniqueSymbolsDeclarationsInJs.errors.txt | 37 ------ .../uniqueSymbolsDeclarationsInJs.types | 10 +- ...ueSymbolsDeclarationsInJsErrors.errors.txt | 5 +- .../uniqueSymbolsDeclarationsInJsErrors.types | 2 +- .../jsdocAccessibilityTags.errors.txt.diff | 107 ++++------------ .../jsdocOverrideTag1.errors.txt.diff | 27 ++-- .../conformance/jsdocReadonly.errors.txt.diff | 35 ------ .../conformance/jsdocReadonly.types.diff | 38 +----- .../jsdocReadonlyDeclarations.types.diff | 32 +---- .../conformance/override_js1.errors.txt.diff | 14 ++- .../conformance/override_js2.errors.txt.diff | 25 ++-- .../conformance/override_js3.errors.txt.diff | 32 ++--- .../conformance/override_js4.errors.txt.diff | 28 ++--- ...mesIncompatibleModifiersJs.errors.txt.diff | 115 ------------------ ...queSymbolsDeclarationsInJs.errors.txt.diff | 42 ------- .../uniqueSymbolsDeclarationsInJs.types.diff | 32 ----- ...bolsDeclarationsInJsErrors.errors.txt.diff | 22 ---- ...ueSymbolsDeclarationsInJsErrors.types.diff | 11 -- 31 files changed, 452 insertions(+), 596 deletions(-) create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/jsdocReadonly.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/override_js3.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/override_js4.errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/privateNamesIncompatibleModifiersJs.errors.txt delete mode 100644 testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/privateNamesIncompatibleModifiersJs.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index df18a8f367..79e2d23a04 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -233,6 +233,11 @@ func (n *Node) TemplateLiteralLikeData() *TemplateLiteralLikeBase { return n.data.TemplateLiteralLikeData() } +type mutableNode Node + +func (n *Node) AsMutable() *mutableNode { return (*mutableNode)(n) } +func (n *mutableNode) SetModifiers(modifiers *ModifierList) { n.data.setModifiers(modifiers) } + func (n *Node) Symbol() *Symbol { data := n.DeclarationData() if data != nil { @@ -1633,6 +1638,7 @@ type nodeData interface { Clone(v NodeFactoryCoercible) *Node Name() *DeclarationName Modifiers() *ModifierList + setModifiers(*ModifierList) FlowNodeData() *FlowNodeBase DeclarationData() *DeclarationBase ExportableData() *ExportableBase @@ -1660,6 +1666,7 @@ func (node *NodeDefault) VisitEachChild(v *NodeVisitor) *Node { re func (node *NodeDefault) Clone(v NodeFactoryCoercible) *Node { return nil } func (node *NodeDefault) Name() *DeclarationName { return nil } func (node *NodeDefault) Modifiers() *ModifierList { return nil } +func (node *NodeDefault) setModifiers(*ModifierList) {} func (node *NodeDefault) FlowNodeData() *FlowNodeBase { return nil } func (node *NodeDefault) DeclarationData() *DeclarationBase { return nil } func (node *NodeDefault) ExportableData() *ExportableBase { return nil } @@ -4759,9 +4766,10 @@ type NamedMemberBase struct { PostfixToken *TokenNode // TokenNode. Optional } -func (node *NamedMemberBase) DeclarationData() *DeclarationBase { return &node.DeclarationBase } -func (node *NamedMemberBase) Modifiers() *ModifierList { return node.modifiers } -func (node *NamedMemberBase) Name() *DeclarationName { return node.name } +func (node *NamedMemberBase) DeclarationData() *DeclarationBase { return &node.DeclarationBase } +func (node *NamedMemberBase) Modifiers() *ModifierList { return node.modifiers } +func (node *NamedMemberBase) setModifiers(modifiers *ModifierList) { node.modifiers = modifiers } +func (node *NamedMemberBase) Name() *DeclarationName { return node.name } // CallSignatureDeclaration diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 3a6363e567..6b19f293b3 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -307,11 +307,11 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_already_seen, "override") } else if flags&ast.ModifierFlagsAmbient != 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_be_used_with_1_modifier, "override", "declare") - } else if flags&ast.ModifierFlagsReadonly != 0 { + } else if flags&ast.ModifierFlagsReadonly != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "override", "readonly") - } else if flags&ast.ModifierFlagsAccessor != 0 { + } else if flags&ast.ModifierFlagsAccessor != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "override", "accessor") - } else if flags&ast.ModifierFlagsAsync != 0 { + } else if flags&ast.ModifierFlagsAsync != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "override", "async") } flags |= ast.ModifierFlagsOverride @@ -324,22 +324,22 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has if flags&ast.ModifierFlagsAccessibilityModifier != 0 { return c.grammarErrorOnNode(modifier, diagnostics.Accessibility_modifier_already_seen) - } else if flags&ast.ModifierFlagsOverride != 0 { + } else if flags&ast.ModifierFlagsOverride != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, text, "override") - } else if flags&ast.ModifierFlagsStatic != 0 { + } else if flags&ast.ModifierFlagsStatic != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, text, "static") - } else if flags&ast.ModifierFlagsAccessor != 0 { + } else if flags&ast.ModifierFlagsAccessor != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, text, "accessor") - } else if flags&ast.ModifierFlagsReadonly != 0 { + } else if flags&ast.ModifierFlagsReadonly != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, text, "readonly") - } else if flags&ast.ModifierFlagsAsync != 0 { + } else if flags&ast.ModifierFlagsAsync != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, text, "async") } else if node.Parent.Kind == ast.KindModuleBlock || node.Parent.Kind == ast.KindSourceFile { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_a_module_or_namespace_element, text) } else if flags&ast.ModifierFlagsAbstract != 0 { if modifier.Kind == ast.KindPrivateKeyword { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_be_used_with_1_modifier, text, "abstract") - } else { + } else if modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, text, "abstract") } } else if ast.IsPrivateIdentifierClassElementDeclaration(node) { @@ -349,11 +349,11 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has case ast.KindStaticKeyword: if flags&ast.ModifierFlagsStatic != 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_already_seen, "static") - } else if flags&ast.ModifierFlagsReadonly != 0 { + } else if flags&ast.ModifierFlagsReadonly != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "static", "readonly") - } else if flags&ast.ModifierFlagsAsync != 0 { + } else if flags&ast.ModifierFlagsAsync != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "static", "async") - } else if flags&ast.ModifierFlagsAccessor != 0 { + } else if flags&ast.ModifierFlagsAccessor != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "static", "accessor") } else if node.Parent.Kind == ast.KindModuleBlock || node.Parent.Kind == ast.KindSourceFile { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_a_module_or_namespace_element, "static") @@ -361,7 +361,7 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_a_parameter, "static") } else if flags&ast.ModifierFlagsAbstract != 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_be_used_with_1_modifier, "static", "abstract") - } else if flags&ast.ModifierFlagsOverride != 0 { + } else if flags&ast.ModifierFlagsOverride != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "static", "override") } flags |= ast.ModifierFlagsStatic @@ -394,11 +394,11 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has } if flags&ast.ModifierFlagsExport != 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_already_seen, "export") - } else if flags&ast.ModifierFlagsAmbient != 0 { + } else if flags&ast.ModifierFlagsAmbient != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "export", "declare") - } else if flags&ast.ModifierFlagsAbstract != 0 { + } else if flags&ast.ModifierFlagsAbstract != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "export", "abstract") - } else if flags&ast.ModifierFlagsAsync != 0 { + } else if flags&ast.ModifierFlagsAsync != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "export", "async") } else if ast.IsClassLike(node.Parent) && !ast.IsJSTypeAliasDeclaration(node) { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_class_elements_of_this_kind, "export") @@ -423,7 +423,7 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration, "default") } else if blockScopeKind == ast.NodeFlagsAwaitUsing { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration, "default") - } else if flags&ast.ModifierFlagsExport == 0 { + } else if flags&ast.ModifierFlagsExport == 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "export", "default") } else if sawExportBeforeDecorators { return c.grammarErrorOnNode(firstDecorator, diagnostics.Decorators_are_not_valid_here) @@ -480,10 +480,10 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has if flags&ast.ModifierFlagsAsync != 0 && lastAsync != nil { return c.grammarErrorOnNode(lastAsync, diagnostics.X_0_modifier_cannot_be_used_with_1_modifier, "async", "abstract") } - if flags&ast.ModifierFlagsOverride != 0 { + if flags&ast.ModifierFlagsOverride != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "abstract", "override") } - if flags&ast.ModifierFlagsAccessor != 0 { + if flags&ast.ModifierFlagsAccessor != 0 && modifier.Flags&ast.NodeFlagsReparsed == 0 { return c.grammarErrorOnNode(modifier, diagnostics.X_0_modifier_must_precede_1_modifier, "abstract", "accessor") } } diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 041fd45f76..ff0676c91b 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -105,39 +105,43 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { } switch tag.Kind { case ast.KindJSDocTypeTag: - if parent.Kind == ast.KindVariableStatement && parent.AsVariableStatement().DeclarationList != nil { - for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { - if declaration.AsVariableDeclaration().Type == nil { - declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, declaration) - break + switch parent.Kind { + case ast.KindVariableStatement: + if parent.AsVariableStatement().DeclarationList != nil { + for _, declaration := range parent.AsVariableStatement().DeclarationList.AsVariableDeclarationList().Declarations.Nodes { + if declaration.AsVariableDeclaration().Type == nil { + declaration.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, declaration) + break + } } } - } else if parent.Kind == ast.KindVariableDeclaration { + case ast.KindVariableDeclaration: if parent.AsVariableDeclaration().Type == nil { parent.AsVariableDeclaration().Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } - } else if parent.Kind == ast.KindPropertyDeclaration { + case ast.KindPropertyDeclaration: declaration := parent.AsPropertyDeclaration() if declaration.Type == nil { declaration.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } - } else if parent.Kind == ast.KindPropertyAssignment { + case ast.KindPropertyAssignment: prop := parent.AsPropertyAssignment() prop.Initializer = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), prop.Initializer) - } else if parent.Kind == ast.KindExportAssignment { + case ast.KindExportAssignment: export := parent.AsExportAssignment() export.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), export.Expression) - } else if parent.Kind == ast.KindReturnStatement { + case ast.KindReturnStatement: ret := parent.AsReturnStatement() ret.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), ret.Expression) - } else if parent.Kind == ast.KindParenthesizedExpression { + case ast.KindParenthesizedExpression: paren := parent.AsParenthesizedExpression() paren.Expression = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), paren.Expression) - } else if parent.Kind == ast.KindExpressionStatement && - parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression { - bin := parent.AsExpressionStatement().Expression.AsBinaryExpression() - if ast.GetAssignmentDeclarationKind(bin) != ast.JSDeclarationKindNone { - bin.Right = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), bin.Right) + case ast.KindExpressionStatement: + if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression { + bin := parent.AsExpressionStatement().Expression.AsBinaryExpression() + if ast.GetAssignmentDeclarationKind(bin) != ast.JSDeclarationKindNone { + bin.Right = p.makeNewTypeAssertion(p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, nil), bin.Right) + } } } case ast.KindJSDocTemplateTag: @@ -178,6 +182,39 @@ func (p *Parser) reparseTags(parent *ast.Node, jsDoc []*ast.Node) { fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression, fun) } } + case ast.KindJSDocReadonlyTag, ast.KindJSDocPrivateTag, ast.KindJSDocPublicTag, ast.KindJSDocProtectedTag, ast.KindJSDocOverrideTag: + switch parent.Kind { + case ast.KindPropertyDeclaration, ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor: + // !!! BinaryExpression (this.p assignments) + var keyword ast.Kind + switch tag.Kind { + case ast.KindJSDocReadonlyTag: + keyword = ast.KindReadonlyKeyword + case ast.KindJSDocPrivateTag: + keyword = ast.KindPrivateKeyword + case ast.KindJSDocPublicTag: + keyword = ast.KindPublicKeyword + case ast.KindJSDocProtectedTag: + keyword = ast.KindProtectedKeyword + case ast.KindJSDocOverrideTag: + keyword = ast.KindOverrideKeyword + } + modifier := p.factory.NewModifier(keyword) + modifier.Loc = tag.Loc + modifier.Flags = p.contextFlags | ast.NodeFlagsReparsed + var nodes []*ast.Node + var loc core.TextRange + if parent.Modifiers() == nil { + nodes = p.nodeSlicePool.NewSlice(1) + nodes[0] = modifier + loc = tag.Loc + } else { + nodes = append(parent.Modifiers().Nodes, modifier) + loc = parent.Modifiers().Loc + } + parent.AsMutable().SetModifiers(p.newModifierList(loc, nodes)) + } + // !!! @extends, @implements, @this, @satisfies } } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt new file mode 100644 index 0000000000..d1ecb43984 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt @@ -0,0 +1,80 @@ +jsdocAccessibilityTag.js(50,14): error TS2341: Property 'priv' is private and only accessible within class 'A'. +jsdocAccessibilityTag.js(58,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. +jsdocAccessibilityTag.js(58,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. +jsdocAccessibilityTag.js(59,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. +jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. + + +==== jsdocAccessibilityTag.js (5 errors) ==== + class A { + /** + * Ap docs + * + * @private + */ + priv = 4; + /** + * Aq docs + * + * @protected + */ + prot = 5; + /** + * Ar docs + * + * @public + */ + pub = 6; + /** @public */ + get ack() { return this.priv } + /** @private */ + set ack(value) { } + } + class C { + constructor() { + /** + * Cp docs + * + * @private + */ + this.priv2 = 1; + /** + * Cq docs + * + * @protected + */ + this.prot2 = 2; + /** + * Cr docs + * + * @public + */ + this.pub2 = 3; + } + h() { return this.priv2 } + } + class B extends A { + m() { + this.priv + this.prot + this.pub + ~~~~ +!!! error TS2341: Property 'priv' is private and only accessible within class 'A'. + } + } + class D extends C { + n() { + this.priv2 + this.prot2 + this.pub2 + } + } + new A().priv + new A().prot + new A().pub + ~~~~ +!!! error TS2341: Property 'priv' is private and only accessible within class 'A'. + ~~~~ +!!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. + new B().priv + new B().prot + new B().pub + ~~~~ +!!! error TS2341: Property 'priv' is private and only accessible within class 'A'. + ~~~~ +!!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. + new C().priv2 + new C().prot2 + new C().pub2 + new D().priv2 + new D().prot2 + new D().pub2 + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.errors.txt index 133bf9dbd2..b3971c3201 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.errors.txt @@ -1,8 +1,9 @@ -0.js(23,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. 0.js(27,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. +0.js(32,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. +0.js(40,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. -==== 0.js (2 errors) ==== +==== 0.js (3 errors) ==== class A { /** @@ -26,8 +27,6 @@ * @returns {boolean} */ foo (a) { - ~~~ -!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. return super.foo(a) } @@ -39,6 +38,8 @@ /** @override */ baz () { + ~~~ +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. } } @@ -47,6 +48,8 @@ class C { /** @override */ foo () { + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReadonly.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocReadonly.errors.txt new file mode 100644 index 0000000000..3cce555727 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocReadonly.errors.txt @@ -0,0 +1,30 @@ +jsdocReadonly.js(23,3): error TS2540: Cannot assign to 'y' because it is a read-only property. + + +==== jsdocReadonly.js (1 errors) ==== + class LOL { + /** + * @readonly + * @private + * @type {number} + * Order rules do not apply to JSDoc + */ + x = 1 + /** @readonly */ + y = 2 + /** @readonly Definitely not here */ + static z = 3 + /** @readonly This is OK too */ + constructor() { + /** ok */ + this.y = 2 + /** @readonly ok */ + this.ka = 2 + } + } + + var l = new LOL() + l.y = 12 + ~ +!!! error TS2540: Cannot assign to 'y' because it is a read-only property. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReadonly.types b/testdata/baselines/reference/submodule/conformance/jsdocReadonly.types index 066dd4947c..843b44c0cd 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReadonly.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocReadonly.types @@ -16,12 +16,12 @@ class LOL { /** @readonly */ y = 2 ->y : number +>y : 2 >2 : 2 /** @readonly Definitely not here */ static z = 3 ->z : number +>z : 3 >3 : 3 /** @readonly This is OK too */ @@ -29,9 +29,9 @@ class LOL { /** ok */ this.y = 2 >this.y = 2 : 2 ->this.y : number +>this.y : 2 >this : this ->y : number +>y : 2 >2 : 2 /** @readonly ok */ @@ -51,8 +51,8 @@ var l = new LOL() l.y = 12 >l.y = 12 : 12 ->l.y : number +>l.y : any >l : LOL ->y : number +>y : any >12 : 12 diff --git a/testdata/baselines/reference/submodule/conformance/jsdocReadonlyDeclarations.types b/testdata/baselines/reference/submodule/conformance/jsdocReadonlyDeclarations.types index f66781d6a4..f62c95121d 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocReadonlyDeclarations.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocReadonlyDeclarations.types @@ -6,7 +6,7 @@ class C { /** @readonly */ x = 6 ->x : number +>x : 6 >6 : 6 /** @readonly */ @@ -15,9 +15,9 @@ class C { this.x = n >this.x = n : any ->this.x : number +>this.x : 6 >this : this ->x : number +>x : 6 >n : any /** @@ -34,10 +34,10 @@ class C { } } new C().x ->new C().x : number +>new C().x : 6 >new C() : C >C : typeof C ->x : number +>x : 6 function F() { >F : () => void diff --git a/testdata/baselines/reference/submodule/conformance/override_js1.errors.txt b/testdata/baselines/reference/submodule/conformance/override_js1.errors.txt index 79b3b91719..65618f3449 100644 --- a/testdata/baselines/reference/submodule/conformance/override_js1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/override_js1.errors.txt @@ -1,8 +1,10 @@ a.js(7,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -a.js(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +a.js(11,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +a.js(17,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +a.js(19,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. -==== a.js (2 errors) ==== +==== a.js (4 errors) ==== class B { foo (v) {} fooo (v) {} @@ -14,16 +16,20 @@ a.js(9,5): error TS4114: This member must have an 'override' modifier because it !!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. /** @override */ fooo (v) {} - ~~~~ -!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. /** @override */ bar(v) {} + ~~~ +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } class C { foo () {} /** @override */ fooo (v) {} + ~~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. /** @override */ bar(v) {} + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/override_js2.errors.txt b/testdata/baselines/reference/submodule/conformance/override_js2.errors.txt index 79b3b91719..65618f3449 100644 --- a/testdata/baselines/reference/submodule/conformance/override_js2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/override_js2.errors.txt @@ -1,8 +1,10 @@ a.js(7,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -a.js(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. +a.js(11,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. +a.js(17,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. +a.js(19,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. -==== a.js (2 errors) ==== +==== a.js (4 errors) ==== class B { foo (v) {} fooo (v) {} @@ -14,16 +16,20 @@ a.js(9,5): error TS4114: This member must have an 'override' modifier because it !!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. /** @override */ fooo (v) {} - ~~~~ -!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. /** @override */ bar(v) {} + ~~~ +!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } class C { foo () {} /** @override */ fooo (v) {} + ~~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. /** @override */ bar(v) {} + ~~~ +!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/override_js3.errors.txt b/testdata/baselines/reference/submodule/conformance/override_js3.errors.txt deleted file mode 100644 index db710adc3f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/override_js3.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -a.js(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. - - -==== a.js (1 errors) ==== - class B { - foo (v) {} - fooo (v) {} - } - - class D extends B { - override foo (v) {} - /** @override */ - fooo (v) {} - ~~~~ -!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/override_js4.errors.txt b/testdata/baselines/reference/submodule/conformance/override_js4.errors.txt new file mode 100644 index 0000000000..9af536777e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/override_js4.errors.txt @@ -0,0 +1,15 @@ +a.js(7,5): error TS4117: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. Did you mean 'doSomething'? + + +==== a.js (1 errors) ==== + class A { + doSomething() {} + } + + class B extends A { + /** @override */ + doSomethang() {} + ~~~~~~~~~~~ +!!! error TS4117: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. Did you mean 'doSomething'? + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/privateNamesIncompatibleModifiersJs.errors.txt b/testdata/baselines/reference/submodule/conformance/privateNamesIncompatibleModifiersJs.errors.txt new file mode 100644 index 0000000000..267ad3982c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/privateNamesIncompatibleModifiersJs.errors.txt @@ -0,0 +1,110 @@ +privateNamesIncompatibleModifiersJs.js(3,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(8,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(13,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(18,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(23,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(28,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(33,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(37,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(42,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(46,8): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(51,7): error TS18010: An accessibility modifier cannot be used with a private identifier. +privateNamesIncompatibleModifiersJs.js(55,8): error TS18010: An accessibility modifier cannot be used with a private identifier. + + +==== privateNamesIncompatibleModifiersJs.js (12 errors) ==== + class A { + /** + * @public + ~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + #a = 1; + + /** + * @private + ~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + #b = 1; + + /** + * @protected + ~~~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + #c = 1; + + /** + * @public + ~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + #aMethod() { return 1; } + + /** + * @private + ~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + #bMethod() { return 1; } + + /** + * @protected + ~~~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + #cMethod() { return 1; } + + /** + * @public + ~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + get #aProp() { return 1; } + /** + * @public + ~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + set #aProp(value) { } + + /** + * @private + ~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + get #bProp() { return 1; } + /** + * @private + ~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + set #bProp(value) { } + + /** + * @protected + ~~~~~~~~~~ + */ + ~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + get #cProp() { return 1; } + /** + * @protected + ~~~~~~~~~~ + */ + ~~~~~ +!!! error TS18010: An accessibility modifier cannot be used with a private identifier. + set #cProp(value) { } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt deleted file mode 100644 index 2c2ac38279..0000000000 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.errors.txt +++ /dev/null @@ -1,37 +0,0 @@ -uniqueSymbolsDeclarationsInJs.js(11,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -uniqueSymbolsDeclarationsInJs.js(16,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - - -==== uniqueSymbolsDeclarationsInJs.js (2 errors) ==== - // classes - class C { - /** - * @readonly - */ - static readonlyStaticCall = Symbol(); - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticType; - ~~~~~~~~~~~~~~~~~~ -!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticTypeAndCall = Symbol(); - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - static readwriteStaticCall = Symbol(); - - /** - * @readonly - */ - readonlyCall = Symbol(); - readwriteCall = Symbol(); - } - - /** @type {unique symbol} */ - const a = Symbol(); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types index 4b44b1dc5e..e812b448aa 100644 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJs.types @@ -9,8 +9,8 @@ class C { * @readonly */ static readonlyStaticCall = Symbol(); ->readonlyStaticCall : symbol ->Symbol() : symbol +>readonlyStaticCall : unique symbol +>Symbol() : unique symbol >Symbol : SymbolConstructor /** @@ -18,15 +18,15 @@ class C { * @readonly */ static readonlyStaticType; ->readonlyStaticType : symbol +>readonlyStaticType : unique symbol /** * @type {unique symbol} * @readonly */ static readonlyStaticTypeAndCall = Symbol(); ->readonlyStaticTypeAndCall : symbol ->Symbol() : symbol +>readonlyStaticTypeAndCall : unique symbol +>Symbol() : unique symbol >Symbol : SymbolConstructor static readwriteStaticCall = Symbol(); diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt index e7c5d274aa..681f7c5f3e 100644 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt @@ -1,9 +1,8 @@ uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -uniqueSymbolsDeclarationsInJsErrors.js(10,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -==== uniqueSymbolsDeclarationsInJsErrors.js (3 errors) ==== +==== uniqueSymbolsDeclarationsInJsErrors.js (2 errors) ==== class C { /** * @type {unique symbol} @@ -16,8 +15,6 @@ uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a cla * @readonly */ static readonlyType; - ~~~~~~~~~~~~ -!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. /** * @type {unique symbol} */ diff --git a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types index f5a9ef8de0..8efd009a30 100644 --- a/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types +++ b/testdata/baselines/reference/submodule/conformance/uniqueSymbolsDeclarationsInJsErrors.types @@ -15,7 +15,7 @@ class C { * @readonly */ static readonlyType; ->readonlyType : symbol +>readonlyType : unique symbol /** * @type {unique symbol} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff index a9461e2374..74ffdd690c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff @@ -1,100 +1,43 @@ --- old.jsdocAccessibilityTags.errors.txt +++ new.jsdocAccessibilityTags.errors.txt -@@= skipped -0, +-1 lines =@@ --jsdocAccessibilityTag.js(50,14): error TS2341: Property 'priv' is private and only accessible within class 'A'. +@@= skipped -0, +0 lines =@@ + jsdocAccessibilityTag.js(50,14): error TS2341: Property 'priv' is private and only accessible within class 'A'. -jsdocAccessibilityTag.js(55,14): error TS2341: Property 'priv2' is private and only accessible within class 'C'. --jsdocAccessibilityTag.js(58,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. --jsdocAccessibilityTag.js(58,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. --jsdocAccessibilityTag.js(59,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. --jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. + jsdocAccessibilityTag.js(58,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. + jsdocAccessibilityTag.js(58,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. + jsdocAccessibilityTag.js(59,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. + jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. -jsdocAccessibilityTag.js(60,9): error TS2341: Property 'priv2' is private and only accessible within class 'C'. -jsdocAccessibilityTag.js(60,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -jsdocAccessibilityTag.js(61,9): error TS2341: Property 'priv2' is private and only accessible within class 'C'. -jsdocAccessibilityTag.js(61,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -- -- + + -==== jsdocAccessibilityTag.js (10 errors) ==== -- class A { -- /** -- * Ap docs -- * -- * @private -- */ -- priv = 4; -- /** -- * Aq docs -- * -- * @protected -- */ -- prot = 5; -- /** -- * Ar docs -- * -- * @public -- */ -- pub = 6; -- /** @public */ -- get ack() { return this.priv } -- /** @private */ -- set ack(value) { } -- } -- class C { -- constructor() { -- /** -- * Cp docs -- * -- * @private -- */ -- this.priv2 = 1; -- /** -- * Cq docs -- * -- * @protected -- */ -- this.prot2 = 2; -- /** -- * Cr docs -- * -- * @public -- */ -- this.pub2 = 3; -- } -- h() { return this.priv2 } -- } -- class B extends A { -- m() { -- this.priv + this.prot + this.pub -- ~~~~ --!!! error TS2341: Property 'priv' is private and only accessible within class 'A'. -- } -- } -- class D extends C { -- n() { -- this.priv2 + this.prot2 + this.pub2 ++==== jsdocAccessibilityTag.js (5 errors) ==== + class A { + /** + * Ap docs +@@= skipped -67, +62 lines =@@ + class D extends C { + n() { + this.priv2 + this.prot2 + this.pub2 - ~~~~~ -!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. -- } -- } -- new A().priv + new A().prot + new A().pub -- ~~~~ --!!! error TS2341: Property 'priv' is private and only accessible within class 'A'. -- ~~~~ --!!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. -- new B().priv + new B().prot + new B().pub -- ~~~~ --!!! error TS2341: Property 'priv' is private and only accessible within class 'A'. -- ~~~~ --!!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. -- new C().priv2 + new C().prot2 + new C().pub2 + } + } + new A().priv + new A().prot + new A().pub +@@= skipped -15, +13 lines =@@ + ~~~~ + !!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. + new C().priv2 + new C().prot2 + new C().pub2 - ~~~~~ -!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. - ~~~~~ -!!! error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -- new D().priv2 + new D().prot2 + new D().pub2 + new D().priv2 + new D().prot2 + new D().pub2 - ~~~~~ -!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. - ~~~~~ -!!! error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -- -@@= skipped --1, +1 lines =@@ -+ + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.errors.txt.diff index 8c1ae33e44..68484dad88 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.errors.txt.diff @@ -4,23 +4,13 @@ -0.js(27,5): error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'A'. -0.js(32,5): error TS4122: This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class 'A'. -0.js(40,5): error TS4121: This member cannot have a JSDoc comment with an '@override' tag because its containing class 'C' does not extend another class. -+0.js(23,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. +0.js(27,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. ++0.js(32,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. ++0.js(40,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. --==== 0.js (3 errors) ==== -+==== 0.js (2 errors) ==== - class A { - - /** -@@= skipped -26, +25 lines =@@ - * @returns {boolean} - */ - foo (a) { -+ ~~~ -+!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'A'. - return super.foo(a) - } + ==== 0.js (3 errors) ==== +@@= skipped -31, +31 lines =@@ bar () { ~~~ @@ -31,17 +21,18 @@ /** @override */ baz () { -- ~~~ + ~~~ -!!! error TS4122: This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class 'A'. ++!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. } } -@@= skipped -21, +21 lines =@@ - class C { +@@= skipped -17, +17 lines =@@ /** @override */ foo () { -- ~~~ + ~~~ -!!! error TS4121: This member cannot have a JSDoc comment with an '@override' tag because its containing class 'C' does not extend another class. ++!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.errors.txt.diff deleted file mode 100644 index 3b894ef5e5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.jsdocReadonly.errors.txt -+++ new.jsdocReadonly.errors.txt -@@= skipped -0, +-1 lines =@@ --jsdocReadonly.js(23,3): error TS2540: Cannot assign to 'y' because it is a read-only property. -- -- --==== jsdocReadonly.js (1 errors) ==== -- class LOL { -- /** -- * @readonly -- * @private -- * @type {number} -- * Order rules do not apply to JSDoc -- */ -- x = 1 -- /** @readonly */ -- y = 2 -- /** @readonly Definitely not here */ -- static z = 3 -- /** @readonly This is OK too */ -- constructor() { -- /** ok */ -- this.y = 2 -- /** @readonly ok */ -- this.ka = 2 -- } -- } -- -- var l = new LOL() -- l.y = 12 -- ~ --!!! error TS2540: Cannot assign to 'y' because it is a read-only property. -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.types.diff index f8ea83fb4c..24e0f95776 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.types.diff @@ -1,31 +1,6 @@ --- old.jsdocReadonly.types +++ new.jsdocReadonly.types -@@= skipped -15, +15 lines =@@ - - /** @readonly */ - y = 2 -->y : 2 -+>y : number - >2 : 2 - - /** @readonly Definitely not here */ - static z = 3 -->z : 3 -+>z : number - >3 : 3 - - /** @readonly This is OK too */ -@@= skipped -13, +13 lines =@@ - /** ok */ - this.y = 2 - >this.y = 2 : 2 -->this.y : 2 -+>this.y : number - >this : this -->y : 2 -+>y : number - >2 : 2 - +@@= skipped -36, +36 lines =@@ /** @readonly ok */ this.ka = 2 >this.ka = 2 : 2 @@ -37,14 +12,3 @@ >2 : 2 } } -@@= skipped -22, +22 lines =@@ - - l.y = 12 - >l.y = 12 : 12 -->l.y : any -+>l.y : number - >l : LOL -->y : any -+>y : number - >12 : 12 - diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff index b13f2960d9..c0e40e05f0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff @@ -1,27 +1,6 @@ --- old.jsdocReadonlyDeclarations.types +++ new.jsdocReadonlyDeclarations.types -@@= skipped -5, +5 lines =@@ - - /** @readonly */ - x = 6 -->x : 6 -+>x : number - >6 : 6 - - /** @readonly */ -@@= skipped -9, +9 lines =@@ - - this.x = n - >this.x = n : any -->this.x : 6 -+>this.x : number - >this : this -->x : 6 -+>x : number - >n : any - - /** -@@= skipped -10, +10 lines =@@ +@@= skipped -24, +24 lines =@@ * @type {number} */ this.y = n @@ -34,13 +13,8 @@ >n : any } } - new C().x -->new C().x : 6 -+>new C().x : number - >new C() : C - >C : typeof C -->x : 6 -+>x : number +@@= skipped -14, +15 lines =@@ + >x : 6 function F() { ->F : typeof F diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/override_js1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/override_js1.errors.txt.diff index bca866718e..e81040a95d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js1.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/override_js1.errors.txt.diff @@ -4,10 +4,12 @@ - @@= skipped --1, +1 lines =@@ +a.js(7,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -+a.js(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. ++a.js(11,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. ++a.js(17,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. ++a.js(19,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + + -+==== a.js (2 errors) ==== ++==== a.js (4 errors) ==== + class B { + foo (v) {} + fooo (v) {} @@ -19,16 +21,20 @@ +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. + /** @override */ + fooo (v) {} -+ ~~~~ -+!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. + /** @override */ + bar(v) {} ++ ~~~ ++!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. + } + + class C { + foo () {} + /** @override */ + fooo (v) {} ++ ~~~~ ++!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + /** @override */ + bar(v) {} ++ ~~~ ++!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff index 23dd7532da..5f3a3c59de 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff @@ -6,15 +6,13 @@ -a.js(17,5): error TS4121: This member cannot have a JSDoc comment with an '@override' tag because its containing class 'C' does not extend another class. -a.js(19,5): error TS4121: This member cannot have a JSDoc comment with an '@override' tag because its containing class 'C' does not extend another class. +a.js(7,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. -+a.js(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. ++a.js(11,5): error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. ++a.js(17,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. ++a.js(19,5): error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. --==== a.js (4 errors) ==== -+==== a.js (2 errors) ==== - class B { - foo (v) {} - fooo (v) {} -@@= skipped -12, +10 lines =@@ + ==== a.js (4 errors) ==== +@@= skipped -12, +12 lines =@@ class D extends B { foo (v) {} ~~~ @@ -22,22 +20,23 @@ +!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. /** @override */ fooo (v) {} -+ ~~~~ -+!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. /** @override */ bar(v) {} -- ~~~ + ~~~ -!!! error TS4122: This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class 'B'. ++!!! error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'B'. } class C { - foo () {} +@@= skipped -14, +14 lines =@@ /** @override */ fooo (v) {} -- ~~~~ + ~~~~ -!!! error TS4121: This member cannot have a JSDoc comment with an '@override' tag because its containing class 'C' does not extend another class. ++!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. /** @override */ bar(v) {} -- ~~~ + ~~~ -!!! error TS4121: This member cannot have a JSDoc comment with an '@override' tag because its containing class 'C' does not extend another class. ++!!! error TS4112: This member cannot have an 'override' modifier because its containing class 'C' does not extend another class. } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/override_js3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/override_js3.errors.txt.diff index 5a4be05132..c53684226f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/override_js3.errors.txt.diff @@ -1,20 +1,22 @@ --- old.override_js3.errors.txt +++ new.override_js3.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -a.js(7,5): error TS8009: The 'override' modifier can only be used in TypeScript files. -+a.js(9,5): error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. - - - ==== a.js (1 errors) ==== -@@= skipped -8, +8 lines =@@ - - class D extends B { - override foo (v) {} +- +- +-==== a.js (1 errors) ==== +- class B { +- foo (v) {} +- fooo (v) {} +- } +- +- class D extends B { +- override foo (v) {} - ~~~~~~~~ -!!! error TS8009: The 'override' modifier can only be used in TypeScript files. - /** @override */ - fooo (v) {} -+ ~~~~ -+!!! error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'B'. - } - +- /** @override */ +- fooo (v) {} +- } +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff index 45ffe347d0..8f7a575fb2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff @@ -1,20 +1,16 @@ --- old.override_js4.errors.txt +++ new.override_js4.errors.txt -@@= skipped -0, +-1 lines =@@ +@@= skipped -0, +0 lines =@@ -a.js(7,5): error TS4123: This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class 'A'. Did you mean 'doSomething'? -- -- --==== a.js (1 errors) ==== -- class A { -- doSomething() {} -- } -- -- class B extends A { -- /** @override */ -- doSomethang() {} -- ~~~~~~~~~~~ ++a.js(7,5): error TS4117: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. Did you mean 'doSomething'? + + + ==== a.js (1 errors) ==== +@@= skipped -9, +9 lines =@@ + /** @override */ + doSomethang() {} + ~~~~~~~~~~~ -!!! error TS4123: This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class 'A'. Did you mean 'doSomething'? -- } -- -@@= skipped --1, +1 lines =@@ -+ ++!!! error TS4117: This member cannot have an 'override' modifier because it is not declared in the base class 'A'. Did you mean 'doSomething'? + } + diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/privateNamesIncompatibleModifiersJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/privateNamesIncompatibleModifiersJs.errors.txt.diff deleted file mode 100644 index fe63de03cb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/privateNamesIncompatibleModifiersJs.errors.txt.diff +++ /dev/null @@ -1,115 +0,0 @@ ---- old.privateNamesIncompatibleModifiersJs.errors.txt -+++ new.privateNamesIncompatibleModifiersJs.errors.txt -@@= skipped -0, +-1 lines =@@ --privateNamesIncompatibleModifiersJs.js(3,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(8,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(13,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(18,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(23,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(28,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(33,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(37,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(42,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(46,8): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(51,7): error TS18010: An accessibility modifier cannot be used with a private identifier. --privateNamesIncompatibleModifiersJs.js(55,8): error TS18010: An accessibility modifier cannot be used with a private identifier. -- -- --==== privateNamesIncompatibleModifiersJs.js (12 errors) ==== -- class A { -- /** -- * @public -- ~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- #a = 1; -- -- /** -- * @private -- ~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- #b = 1; -- -- /** -- * @protected -- ~~~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- #c = 1; -- -- /** -- * @public -- ~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- #aMethod() { return 1; } -- -- /** -- * @private -- ~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- #bMethod() { return 1; } -- -- /** -- * @protected -- ~~~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- #cMethod() { return 1; } -- -- /** -- * @public -- ~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- get #aProp() { return 1; } -- /** -- * @public -- ~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- set #aProp(value) { } -- -- /** -- * @private -- ~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- get #bProp() { return 1; } -- /** -- * @private -- ~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- set #bProp(value) { } -- -- /** -- * @protected -- ~~~~~~~~~~ -- */ -- ~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- get #cProp() { return 1; } -- /** -- * @protected -- ~~~~~~~~~~ -- */ -- ~~~~~ --!!! error TS18010: An accessibility modifier cannot be used with a private identifier. -- set #cProp(value) { } -- } -- -@@= skipped --1, +1 lines =@@ -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff deleted file mode 100644 index d9ecf89023..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff +++ /dev/null @@ -1,42 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJs.errors.txt -+++ new.uniqueSymbolsDeclarationsInJs.errors.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+uniqueSymbolsDeclarationsInJs.js(11,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -+uniqueSymbolsDeclarationsInJs.js(16,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -+ -+ -+==== uniqueSymbolsDeclarationsInJs.js (2 errors) ==== -+ // classes -+ class C { -+ /** -+ * @readonly -+ */ -+ static readonlyStaticCall = Symbol(); -+ /** -+ * @type {unique symbol} -+ * @readonly -+ */ -+ static readonlyStaticType; -+ ~~~~~~~~~~~~~~~~~~ -+!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -+ /** -+ * @type {unique symbol} -+ * @readonly -+ */ -+ static readonlyStaticTypeAndCall = Symbol(); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -+ static readwriteStaticCall = Symbol(); -+ -+ /** -+ * @readonly -+ */ -+ readonlyCall = Symbol(); -+ readwriteCall = Symbol(); -+ } -+ -+ /** @type {unique symbol} */ -+ const a = Symbol(); -+ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff deleted file mode 100644 index 8443abafa1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.types.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJs.types -+++ new.uniqueSymbolsDeclarationsInJs.types -@@= skipped -8, +8 lines =@@ - * @readonly - */ - static readonlyStaticCall = Symbol(); -->readonlyStaticCall : unique symbol -->Symbol() : unique symbol -+>readonlyStaticCall : symbol -+>Symbol() : symbol - >Symbol : SymbolConstructor - - /** -@@= skipped -9, +9 lines =@@ - * @readonly - */ - static readonlyStaticType; -->readonlyStaticType : unique symbol -+>readonlyStaticType : symbol - - /** - * @type {unique symbol} - * @readonly - */ - static readonlyStaticTypeAndCall = Symbol(); -->readonlyStaticTypeAndCall : unique symbol -->Symbol() : unique symbol -+>readonlyStaticTypeAndCall : symbol -+>Symbol() : symbol - >Symbol : SymbolConstructor - - static readwriteStaticCall = Symbol(); diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff deleted file mode 100644 index 83db4d5e84..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJsErrors.errors.txt -+++ new.uniqueSymbolsDeclarationsInJsErrors.errors.txt -@@= skipped -0, +0 lines =@@ - uniqueSymbolsDeclarationsInJsErrors.js(5,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. -+uniqueSymbolsDeclarationsInJsErrors.js(10,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - uniqueSymbolsDeclarationsInJsErrors.js(14,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - - --==== uniqueSymbolsDeclarationsInJsErrors.js (2 errors) ==== -+==== uniqueSymbolsDeclarationsInJsErrors.js (3 errors) ==== - class C { - /** - * @type {unique symbol} -@@= skipped -14, +15 lines =@@ - * @readonly - */ - static readonlyType; -+ ~~~~~~~~~~~~ -+!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. - /** - * @type {unique symbol} - */ diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff deleted file mode 100644 index e4b437654f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJsErrors.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJsErrors.types -+++ new.uniqueSymbolsDeclarationsInJsErrors.types -@@= skipped -14, +14 lines =@@ - * @readonly - */ - static readonlyType; -->readonlyType : unique symbol -+>readonlyType : symbol - - /** - * @type {unique symbol} From f1968fe7710057c212b0e534da46fe599fd2fe0c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 23 May 2025 14:20:36 -0700 Subject: [PATCH 2/4] hereby lint; hereby format --- internal/ast/ast.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index ac7bdf26b3..e5b0e09203 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -235,7 +235,7 @@ func (n *Node) TemplateLiteralLikeData() *TemplateLiteralLikeBase { type mutableNode Node -func (n *Node) AsMutable() *mutableNode { return (*mutableNode)(n) } +func (n *Node) AsMutable() *mutableNode { return (*mutableNode)(n) } func (n *mutableNode) SetModifiers(modifiers *ModifierList) { n.data.setModifiers(modifiers) } func (n *Node) Symbol() *Symbol { @@ -1638,7 +1638,7 @@ type nodeData interface { Clone(v NodeFactoryCoercible) *Node Name() *DeclarationName Modifiers() *ModifierList - setModifiers(*ModifierList) + setModifiers(modifiers *ModifierList) FlowNodeData() *FlowNodeBase DeclarationData() *DeclarationBase ExportableData() *ExportableBase From a84616bc0a9ee3e5f908c8341e448c38a844318b Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 28 May 2025 06:13:27 -0700 Subject: [PATCH 3/4] fix lint --- internal/ast/ast.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index e5b0e09203..bd8de3b669 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -1666,7 +1666,7 @@ func (node *NodeDefault) VisitEachChild(v *NodeVisitor) *Node { re func (node *NodeDefault) Clone(v NodeFactoryCoercible) *Node { return nil } func (node *NodeDefault) Name() *DeclarationName { return nil } func (node *NodeDefault) Modifiers() *ModifierList { return nil } -func (node *NodeDefault) setModifiers(*ModifierList) {} +func (node *NodeDefault) setModifiers(modifiers *ModifierList) {} func (node *NodeDefault) FlowNodeData() *FlowNodeBase { return nil } func (node *NodeDefault) DeclarationData() *DeclarationBase { return nil } func (node *NodeDefault) ExportableData() *ExportableBase { return nil } From a921b63f2ac6b74aab578c75b7353b3cf80bc8e7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 10 Jun 2025 09:29:35 -0700 Subject: [PATCH 4/4] Support BinaryExpressions too --- internal/ast/ast.go | 2 + internal/parser/reparser.go | 6 ++- .../jsdocAccessibilityTags.errors.txt | 17 ++++++- .../jsdocAccessibilityTags.errors.txt.diff | 45 ------------------- 4 files changed, 22 insertions(+), 48 deletions(-) delete mode 100644 testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 02f7239ae0..a1b5f47830 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -5619,6 +5619,8 @@ func (node *BinaryExpression) computeSubtreeFacts() SubtreeFacts { core.IfElse(node.OperatorToken.Kind == KindInKeyword && IsPrivateIdentifier(node.Left), SubtreeContainsClassFields, SubtreeFactsNone) } +func (node *BinaryExpression) setModifiers(modifiers *ModifierList) { node.modifiers = modifiers } + func IsBinaryExpression(node *Node) bool { return node.Kind == KindBinaryExpression } diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 192f61d671..1e667571a8 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -276,9 +276,11 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) } } case ast.KindJSDocReadonlyTag, ast.KindJSDocPrivateTag, ast.KindJSDocPublicTag, ast.KindJSDocProtectedTag, ast.KindJSDocOverrideTag: + if parent.Kind == ast.KindExpressionStatement { + parent = parent.AsExpressionStatement().Expression + } switch parent.Kind { - case ast.KindPropertyDeclaration, ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor: - // !!! BinaryExpression (this.p assignments) + case ast.KindPropertyDeclaration, ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindBinaryExpression: var keyword ast.Kind switch tag.Kind { case ast.KindJSDocReadonlyTag: diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt index d1ecb43984..6386334b80 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt @@ -1,11 +1,16 @@ jsdocAccessibilityTag.js(50,14): error TS2341: Property 'priv' is private and only accessible within class 'A'. +jsdocAccessibilityTag.js(55,14): error TS2341: Property 'priv2' is private and only accessible within class 'C'. jsdocAccessibilityTag.js(58,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. jsdocAccessibilityTag.js(58,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. jsdocAccessibilityTag.js(59,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. +jsdocAccessibilityTag.js(60,9): error TS2341: Property 'priv2' is private and only accessible within class 'C'. +jsdocAccessibilityTag.js(60,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. +jsdocAccessibilityTag.js(61,9): error TS2341: Property 'priv2' is private and only accessible within class 'C'. +jsdocAccessibilityTag.js(61,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -==== jsdocAccessibilityTag.js (5 errors) ==== +==== jsdocAccessibilityTag.js (10 errors) ==== class A { /** * Ap docs @@ -63,6 +68,8 @@ jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and class D extends C { n() { this.priv2 + this.prot2 + this.pub2 + ~~~~~ +!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. } } new A().priv + new A().prot + new A().pub @@ -76,5 +83,13 @@ jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and ~~~~ !!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. new C().priv2 + new C().prot2 + new C().pub2 + ~~~~~ +!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. + ~~~~~ +!!! error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. new D().priv2 + new D().prot2 + new D().pub2 + ~~~~~ +!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. + ~~~~~ +!!! error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff deleted file mode 100644 index 89e2e165b2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.jsdocAccessibilityTags.errors.txt -+++ new.jsdocAccessibilityTags.errors.txt -@@= skipped -0, +0 lines =@@ - jsdocAccessibilityTag.js(50,14): error TS2341: Property 'priv' is private and only accessible within class 'A'. --jsdocAccessibilityTag.js(55,14): error TS2341: Property 'priv2' is private and only accessible within class 'C'. - jsdocAccessibilityTag.js(58,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. - jsdocAccessibilityTag.js(58,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. - jsdocAccessibilityTag.js(59,9): error TS2341: Property 'priv' is private and only accessible within class 'A'. - jsdocAccessibilityTag.js(59,24): error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. --jsdocAccessibilityTag.js(60,9): error TS2341: Property 'priv2' is private and only accessible within class 'C'. --jsdocAccessibilityTag.js(60,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. --jsdocAccessibilityTag.js(61,9): error TS2341: Property 'priv2' is private and only accessible within class 'C'. --jsdocAccessibilityTag.js(61,25): error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. -- -- --==== jsdocAccessibilityTag.js (10 errors) ==== -+ -+ -+==== jsdocAccessibilityTag.js (5 errors) ==== - class A { - /** - * Ap docs -@@= skipped -67, +62 lines =@@ - class D extends C { - n() { - this.priv2 + this.prot2 + this.pub2 -- ~~~~~ --!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. - } - } - new A().priv + new A().prot + new A().pub -@@= skipped -15, +13 lines =@@ - ~~~~ - !!! error TS2445: Property 'prot' is protected and only accessible within class 'A' and its subclasses. - new C().priv2 + new C().prot2 + new C().pub2 -- ~~~~~ --!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. -- ~~~~~ --!!! error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. - new D().priv2 + new D().prot2 + new D().pub2 -- ~~~~~ --!!! error TS2341: Property 'priv2' is private and only accessible within class 'C'. -- ~~~~~ --!!! error TS2445: Property 'prot2' is protected and only accessible within class 'C' and its subclasses. - \ No newline at end of file