Repository navigation
fix(effect): rule type queries read the types the check recorded (#112) - #113
Open
joaomarcelo09 wants to merge 1 commit into
Open
joaomarcelo09 wants to merge 1 commit into
joaomarcelo09 wants to merge 1 commit into
Conversation
…gdotgg#112) With the Effect plugin, floatingEffect asked the checker for the type of a call statement after the file's check. The checker's quick path for a call (get_quick_type_of_expression) runs check_non_null_expression on the callee, which added a TS18048 or TS2532 next to the TS2722 that tsc reports. Port Effect-TS/tsgo#860 (first released in @effect/tsgo@0.53.2) ahead of the 0.51.1 pin: exit_check_expression records the final expression types of the file's check (patch 033), after_check_source_file pauses recording while the rules run, and get_type_at_location reads the record first. PORTING.md lists the difference from 0.51.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
🤖 Claude Opus 5.5 writing on behalf of Joao
Fixes #112.
Problem
With the Effect plugin, a statement that calls a possibly-undefined function gets a TS18048 or TS2532 next to the TS2722 that
tscreports.floatingEffectasksTypeParser::get_type_at_locationfor the statement's type after the file's check. For a call, the checker's quick path (get_quick_type_of_expression) runscheck_non_null_expressionon the callee, and that reports the extra diagnostic.Fix
A port of Effect-TS/tsgo#860 (first released in
@effect/tsgo@0.53.2), ahead of the 0.51.1 pin:checker/checker_p09.rs:exit_check_expressioncallsrecord_checked_expression_type(patch 033ExpressionCheckedCallback). It runs only when the program has Effect options, as patch 004 does for relation errors.effect/typeparser/checked_expression_types.rs(Gochecked_expression_types.go): records final-mode results (Normal, or Contextual alone) while a file is checked,pause_checked_expression_types, andchecked_expression_type, which reads the record, then the checker'sresolved_typecache.effect/mod.rs:after_check_source_filepauses recording while the rules run (Godefer typeparser.PauseCheckedExpressionTypes(c)()).effect/typeparser/get_type_at_location.rs: readschecked_expression_typebefore it asks the checker.effect/PORTING.md: lists this as a difference from 0.51.1.The checker's own output does not change. Without the plugin no type is recorded.
Measured
Repro (the issue's, plus
await g()and an initializer, wheretscitself reports the pair):typescript@7.1.0-betatscconst r = f()main(91f3d02)f(), TS2532 onfs[0]()and TS18048 onawait g()tsctests/tsgo_effect_type_query.rs: the repro with and without the plugin, against thetscoutput.cargo test --release -p ts_goport --test effect_cases: 1,060 passed, 0 failed.cargo clippyon the new test andrustfmt --edition 2024on the changed files are clean.Not run: the goport protected set (goport tests, gate, bound runs, LSP and API oracles). It needs the Blacksmith testboxes and hosts that a fork cannot use. Built on Arch Linux x86_64 with Rust 1.95.0 (stable, no nightly).
Ported and tested by Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code