diff --git a/internal/ast/ast.go b/internal/ast/ast.go index 56469066bb..d01852e3f6 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -234,6 +234,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 { @@ -1644,6 +1649,7 @@ type nodeData interface { Clone(v NodeFactoryCoercible) *Node Name() *DeclarationName Modifiers() *ModifierList + setModifiers(modifiers *ModifierList) FlowNodeData() *FlowNodeBase DeclarationData() *DeclarationBase ExportableData() *ExportableBase @@ -1671,6 +1677,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(modifiers *ModifierList) {} func (node *NodeDefault) FlowNodeData() *FlowNodeBase { return nil } func (node *NodeDefault) DeclarationData() *DeclarationBase { return nil } func (node *NodeDefault) ExportableData() *ExportableBase { return nil } @@ -4802,9 +4809,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 @@ -5612,6 +5620,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/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 3580fc96c5..1092c3e136 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -308,11 +308,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 @@ -325,22 +325,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) { @@ -350,11 +350,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") @@ -362,7 +362,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 @@ -395,11 +395,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") @@ -424,7 +424,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) @@ -481,10 +481,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 34e0b49f2c..dc6c661c8f 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -183,53 +183,57 @@ func (p *Parser) gatherTypeParameters(j *ast.Node) *ast.NodeList { func (p *Parser) reparseHosted(tag *ast.Node, 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.KindCommonJSExport { + case ast.KindCommonJSExport: export := parent.AsCommonJSExport() if export.Type == nil { export.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() if prop.Type == nil { prop.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } - } else if parent.Kind == ast.KindShorthandPropertyAssignment { + case ast.KindShorthandPropertyAssignment: prop := parent.AsShorthandPropertyAssignment() if prop.Type == nil { prop.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } - } else if parent.Kind == ast.KindExportAssignment || parent.Kind == ast.KindJSExportAssignment { + case ast.KindExportAssignment, ast.KindJSExportAssignment: export := parent.AsExportAssignment() if export.Type == nil { export.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent) } - } 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 kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone { - bin.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent.AsExpressionStatement().Expression) + case ast.KindExpressionStatement: + if parent.AsExpressionStatement().Expression.Kind == ast.KindBinaryExpression { + bin := parent.AsExpressionStatement().Expression.AsBinaryExpression() + if kind := ast.GetAssignmentDeclarationKind(bin); kind != ast.JSDeclarationKindNone { + bin.Type = p.makeNewType(tag.AsJSDocTypeTag().TypeExpression, parent.AsExpressionStatement().Expression) + } } } case ast.KindJSDocTemplateTag: @@ -268,6 +272,40 @@ func (p *Parser) reparseHosted(tag *ast.Node, 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: + if parent.Kind == ast.KindExpressionStatement { + parent = parent.AsExpressionStatement().Expression + } + switch parent.Kind { + case ast.KindPropertyDeclaration, ast.KindMethodDeclaration, ast.KindGetAccessor, ast.KindSetAccessor, ast.KindBinaryExpression: + 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)) + } case ast.KindJSDocImplementsTag: if class := getClassLikeData(parent); class != nil { implementsTag := tag.AsJSDocImplementsTag() 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..6386334b80 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocAccessibilityTags.errors.txt @@ -0,0 +1,95 @@ +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) ==== + 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 + ~~~~~ +!!! 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 + ~~~~~ +!!! 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/submodule/conformance/jsdocOverrideTag1.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocOverrideTag1.errors.txt index 9d125dbf18..d6655383b2 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 TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'A'. 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 (2 errors) ==== +==== 0.js (3 errors) ==== class A { /** @@ -26,8 +27,6 @@ * @returns {boolean} */ foo (a) { - ~~~ -!!! error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'A'. return super.foo(a) } @@ -39,6 +38,8 @@ /** @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'. } } @@ -47,6 +48,8 @@ class C { /** @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. } } \ 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 54dac37ff9..1fd313cd37 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 /** @@ -33,10 +33,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_js2.errors.txt b/testdata/baselines/reference/submodule/conformance/override_js2.errors.txt index 02778eb8e8..2240d94df8 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 TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. -a.js(9,5): error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. +a.js(11,5): error TS4122: This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class 'B'. +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 (2 errors) ==== +==== a.js (4 errors) ==== class B { foo (v) {} fooo (v) {} @@ -14,16 +16,20 @@ a.js(9,5): error TS4119: This member must have a JSDoc comment with an '@overrid !!! error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. /** @override */ fooo (v) {} - ~~~~ -!!! error TS4119: This member must have a JSDoc comment with an '@override' tag 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'. } class C { foo () {} /** @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. /** @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. } \ 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 cb2d2b5b6e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/override_js3.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -a.js(9,5): error TS4119: This member must have a JSDoc comment with an '@override' tag 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 TS4119: This member must have a JSDoc comment with an '@override' tag 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..0e3d59fcf6 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/override_js4.errors.txt @@ -0,0 +1,15 @@ +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() {} + ~~~~~~~~~~~ +!!! 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'? + } + \ 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 deleted file mode 100644 index c326831c37..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAccessibilityTags.errors.txt.diff +++ /dev/null @@ -1,99 +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) ==== -- 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 -- ~~~~~ --!!! 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 -- ~~~~~ --!!! 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/jsdocOverrideTag1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.errors.txt.diff deleted file mode 100644 index 815f3a3ca4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocOverrideTag1.errors.txt.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.jsdocOverrideTag1.errors.txt -+++ new.jsdocOverrideTag1.errors.txt -@@= skipped -0, +0 lines =@@ -+0.js(23,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(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 (3 errors) ==== -+ -+ -+==== 0.js (2 errors) ==== - class A { - - /** -@@= skipped -26, +25 lines =@@ - * @returns {boolean} - */ - foo (a) { -+ ~~~ -+!!! error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'A'. - return super.foo(a) - } - -@@= skipped -11, +13 lines =@@ - - /** @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'. - - } - } -@@= skipped -10, +8 lines =@@ - class C { - /** @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. - - } - } \ No newline at end of file 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 127a80af13..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.jsdocReadonly.errors.txt -+++ new.jsdocReadonly.errors.txt -@@= skipped -0, +0 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. -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonly.types.diff index 064200c173..a12f1b5ea8 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 @@ -36,14 +11,4 @@ +>ka : number >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 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff index ddddffee2e..e2067902d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocReadonlyDeclarations.types.diff @@ -1,36 +1,7 @@ --- 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 -18, +18 lines =@@ - } - } - new C().x -->new C().x : 6 -+>new C().x : number - >new C() : C - >C : typeof C -->x : 6 -+>x : number +@@= skipped -38, +38 lines =@@ + >x : 6 function F() { ->F : typeof F diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff deleted file mode 100644 index 36ce7cb7c4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js2.errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.override_js2.errors.txt -+++ new.override_js2.errors.txt -@@= skipped -0, +0 lines =@@ - a.js(7,5): error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. --a.js(11,5): error TS4122: This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class 'B'. --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 (4 errors) ==== -+a.js(9,5): error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. -+ -+ -+==== a.js (2 errors) ==== - class B { - foo (v) {} - fooo (v) {} -@@= skipped -15, +13 lines =@@ - !!! error TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. - /** @override */ - fooo (v) {} -+ ~~~~ -+!!! error TS4119: This member must have a JSDoc comment with an '@override' tag 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'. - } - - class C { - foo () {} - /** @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. - /** @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. - } \ No newline at end of file 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 de27d1c50f..81561936e0 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/override_js3.errors.txt.diff @@ -2,19 +2,20 @@ +++ new.override_js3.errors.txt @@= skipped -0, +0 lines =@@ -a.js(7,5): error TS8009: The 'override' modifier can only be used in TypeScript files. -+a.js(9,5): error TS4119: This member must have a JSDoc comment with an '@override' tag 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 TS4119: This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class 'B'. - } - \ No newline at end of file +- /** @override */ +- fooo (v) {} +- } +- ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff deleted file mode 100644 index 91d79a9e86..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/override_js4.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.override_js4.errors.txt -+++ new.override_js4.errors.txt -@@= 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() {} -- ~~~~~~~~~~~ --!!! 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'? -- } -- -+ \ No newline at end of file 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 fd0636e013..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/privateNamesIncompatibleModifiersJs.errors.txt.diff +++ /dev/null @@ -1,114 +0,0 @@ ---- old.privateNamesIncompatibleModifiersJs.errors.txt -+++ new.privateNamesIncompatibleModifiersJs.errors.txt -@@= skipped -0, +0 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) { } -- } -- -+ \ No newline at end of file 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 d8f7e8eb4c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/uniqueSymbolsDeclarationsInJs.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.uniqueSymbolsDeclarationsInJs.errors.txt -+++ new.uniqueSymbolsDeclarationsInJs.errors.txt -@@= skipped -0, +0 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(); -+ \ No newline at end of file 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 945ead90c6..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(); \ No newline at end of file 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 bb59446973..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} - */ \ No newline at end of file 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 cda47b348c..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} \ No newline at end of file