Skip to content

More fixes to type checking #801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 17, 2025
Merged

More fixes to type checking #801

merged 17 commits into from
Apr 17, 2025

Conversation

ahejlsberg
Copy link
Member

No description provided.

@ahejlsberg ahejlsberg requested review from Copilot and jakebailey and removed request for Copilot April 16, 2025 20:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 138 out of 147 changed files in this pull request and generated no comments.

Files not reviewed (9)
  • testdata/baselines/reference/submodule/compiler/expressionWithJSDocTypeArguments.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/expressionWithJSDocTypeArguments.js.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/expressionWithJSDocTypeArguments.types: Language not supported
  • testdata/baselines/reference/submodule/compiler/expressionWithJSDocTypeArguments.types.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/jsxImportSourceNonPragmaComment.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/jsxIntrinsicElementsTypeArgumentErrors.errors.txt.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInName.symbols: Language not supported
  • testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInName.symbols.diff: Language not supported
  • testdata/baselines/reference/submodule/compiler/jsxNamespacePrefixInNameReact.symbols: Language not supported
Comments suppressed due to low confidence (3)

internal/scanner/scanner.go:1014

  • The removal of the error reporting call for unterminated regex literals might result in silent failures. Consider either reintroducing the error logging or providing an alternative mechanism to ensure that unterminated regular expressions are appropriately reported.
s.error(diagnostics.Unterminated_regular_expression_literal)

internal/binder/binder.go:327

  • [nitpick] Ensure that the updated condition handling JSX namespaced names covers all edge cases. Consider adding unit tests to validate behavior for namespaced JSX identifiers.
if ast.IsPropertyNameLiteral(name) || ast.IsJsxNamespacedName(name) {

internal/checker/checker.go:6627

  • [nitpick] Double-check that excluding type parameter declarations from unused local diagnostics does not inadvertently hide genuine unused variables. Verify that this change aligns with the overall intended behavior of the diagnostic checks.
if !ast.IsTypeParameterDeclaration(declaration) && !ast.IsAmbientModule(declaration) {

@@ -1266,23 +1265,3 @@ func (c *Checker) getJsxNamespaceContainerForImplicitImport(location *ast.Node)
func (c *Checker) getJSXRuntimeImportSpecifier(file *ast.SourceFile) (moduleReference string, specifier *ast.Node) {
return c.program.GetJSXRuntimeImportSpecifier(file.Path())
}

func getPragmaFromSourceFile(file *ast.SourceFile, name string) *ast.Pragma {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoot, I must have forgotten to delete this.

@@ -43,79 +17,27 @@ expressionWithJSDocTypeArguments.ts(27,39): error TS1109: Expression expected.
~
!!! error TS1110: Type expected.
const HuhFoo = foo<string?>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was an intentional difference? https://github.com/microsoft/typescript-go/blob/main/CHANGES.md#parser:~:text=No%20postfix%20T%3F%20and%20T!%20types. notes that as a removed thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hadn't noticed that we were going to outlaw the postfix forms. Let's discuss and if we still feel that way we can back it out. Or we could continue to parse them (for better error recovery) and then always issue a grammar error.

Comment on lines 32 to +33
->a:attr : Symbol(a:attr, Decl(jsxNamespacePrefixInName.tsx, 18, 22))
+>a:attr : Symbol("�missing", Decl(jsxNamespacePrefixInName.tsx, 18, 22))
+>a:attr : Symbol("a:attr", Decl(jsxNamespacePrefixInName.tsx, 18, 22))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I wonder where the symbol printing differs for this now, since it's just quoting left.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It comes from this commit.

@ahejlsberg ahejlsberg added this pull request to the merge queue Apr 17, 2025
Merged via the queue into main with commit 222ef9b Apr 17, 2025
23 checks passed
@jakebailey jakebailey deleted the more-types-45 branch April 17, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants