Skip to content

Optimize getTypeAtLocation usage on non-expression nodes#490

Merged
mattiamanzati merged 1 commit intomainfrom
optimize-type-at-location-usage
Nov 13, 2025
Merged

Optimize getTypeAtLocation usage on non-expression nodes#490
mattiamanzati merged 1 commit intomainfrom
optimize-type-at-location-usage

Conversation

@mattiamanzati
Copy link
Contributor

Summary

This patch optimizes the language service by reducing unnecessary getTypeAtLocation calls and improving null safety in symbol resolution.

Changes

  • LayerGraph.ts: Only call getTypeAtLocation when node is an expression (added ts.isExpression check)
  • TypeParser.ts: Validate node type before calling getTypeAtLocation in importedContextModule and importedDataModule functions
  • leakingRequirements.ts: Add null safety check for aliased symbols
  • strictBooleanExpressions.ts: Only perform type checking on expression nodes

Performance Impact

By ensuring getTypeAtLocation is only called on expression nodes, this reduces unnecessary type checker calls that could potentially be expensive or produce incorrect results.

Test Plan

  • All existing tests pass
  • pnpm lint-fix completes without issues
  • pnpm check passes TypeScript validation
  • pnpm test - all 316 tests passing

🤖 Generated with Claude Code

This patch reduces unnecessary getTypeAtLocation calls by ensuring they are only performed on expression nodes, and adds additional null safety checks for symbol resolution.

Changes:
- LayerGraph: Only call getTypeAtLocation when node is an expression
- TypeParser: Check node type before calling getTypeAtLocation in importedContextModule and importedDataModule
- leakingRequirements: Add null check for aliased symbol
- strictBooleanExpressions: Only check types for expression nodes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: 9f42af9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/language-service Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mattiamanzati mattiamanzati merged commit 7d2e6dc into main Nov 13, 2025
3 checks passed
@mattiamanzati mattiamanzati deleted the optimize-type-at-location-usage branch November 13, 2025 11:07
@github-actions github-actions bot mentioned this pull request Nov 13, 2025
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.

1 participant