Skip to content

Fix TOML parse error locations#4098

Open
goutamadwant wants to merge 1 commit into
facebook:mainfrom
goutamadwant:fix-toml-error-location
Open

Fix TOML parse error locations#4098
goutamadwant wants to merge 1 commit into
facebook:mainfrom
goutamadwant:fix-toml-error-location

Conversation

@goutamadwant

Copy link
Copy Markdown
Contributor

Summary

Fixes #4060

This fixes TOML parse diagnostics so invalid config values point at the offending value instead of the start of the file.

The config parser now keeps usable TOML span information and adjusts broad serde validation spans to the matching TOML value span when possible. The playground now uses the same config parser and reports the derived range instead of hardcoding line 1, column 1.

Test Plan

  • cargo test -p pyrefly_config
  • cargo test -p pyrefly test_config_toml_parse_error_range -- --nocapture
  • cargo fmt --all -- --check

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TOML parse error shows incorrect location

1 participant