Fix __unknown__ module names for files without a config#4136
Conversation
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
@kinto0 has imported this pull request. If you are a Meta employee, you can view this in D111830464. |
stroxler
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
connernilsen
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
one more question (and an alternate approach suggestion): what project doesn't work with coverage? I expect projects that don't work on coverage to also have name issues with We wanted to keep If we find that this is an issue in coverage and not check, I'd like to limit this change to |
Any directory without a config reproduces it: mkdir demo && cd demo
printf 'def f(x: int) -> int:\n return x\n\ndef g(x, y):\n return x + y\n' > a.py
pyrefly coverage check --public-onlyOn main this reports
Well, this PR doesn't remove it, it just moves it to
So this is indeed a coverage-only thing. So if |
|
interesting. I had a gap in my understanding related to the downstream effect of this module name. looks like it doesn't change check. I'll merge your PR here and add a follow-up to remove the conditional on |
|
#4157 if you have thoughts. it looks like you added the (note the PR also includes these changes. you can go to a single commit to see just the new part) |
Summary
CLI handles were named without checking the config's
fallback_search_path, so in a directory without a config every file was__unknown__, and no symbol FQN could match the public FQNs inpyrefly coverage {check, report} --public-only.ConfigFile::handle_from_module_pathnow applies its ownfallback_search_path(i.e. what the LSP already did), so thathandle_from_module_path_with_fallbackis now no longer needed.Fixes #4132
Test Plan
Regression test added, and verified that
pyrefly coverage check --public-onlyin a directory without pyrefly config now reports the same as without--public-only.