Skip to content

Conversation

ahejlsberg
Copy link
Member

Fixes #1442.

@Copilot Copilot AI review requested due to automatic review settings July 24, 2025 19:53
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.

Pull Request Overview

This PR standardizes the way signature type parameters are checked throughout the codebase by consistently using len(x.typeParameters) != 0 instead of x.typeParameters != nil. This change improves code consistency and likely fixes edge cases where empty slices were being treated differently from nil slices.

  • Replaces nil checks with length checks for signature type parameters across multiple files
  • Updates test baselines to reflect improved error messages and type inference behavior
  • Ensures consistent handling of generic signatures throughout the type checker

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/checker/relater.go Updates signature comparison and type predicate logic to use length checks
internal/checker/nodebuilderimpl.go Modifies signature declaration helper to use length checks and simplifies conditional logic
internal/checker/flow.go Updates effects signature detection to use length checks
internal/checker/checker.go Converts multiple signature type parameter checks from nil to length-based
testdata/baselines/reference/submodule/compiler/jsxComponentTypeErrors.errors.txt* Updates test baselines showing improved JSX error messages
testdata/baselines/reference/submodule/compiler/abstractClassUnionInstantiation.types* Updates test baselines showing improved union type inference

@ahejlsberg
Copy link
Member Author

We already have a couple of failing tests that this fixes, so don't think we need additional tests.

@ahejlsberg ahejlsberg requested a review from jakebailey July 24, 2025 19:55
@jakebailey jakebailey enabled auto-merge July 24, 2025 20:05
@jakebailey jakebailey added this pull request to the merge queue Jul 24, 2025
Merged via the queue into main with commit c72f1ea Jul 24, 2025
22 checks passed
@jakebailey jakebailey deleted the fix-1442 branch July 24, 2025 20:22
@Eigilak
Copy link

Eigilak commented Jul 25, 2025

Altid en fornøjelse jo! 🙌

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.

react class components from ternaries give no construct or call signature upon rendering

3 participants