-
Notifications
You must be signed in to change notification settings - Fork 477
Migration tool fixes #8157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zth
wants to merge
8
commits into
master
Choose a base branch
from
migration-tool-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Migration tool fixes #8157
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f9e1c93
make migration tool not write files unless they have actual changes
zth 2eaf010
ensure migrations are not attempted on anything but project files
zth 9de4952
changelog
zth 72cef3e
update lockfile
zth f44f5e4
reuse package
zth 650d0c6
precompute
zth 0d98a22
fix dependency path filter
zth 9435093
fix
zth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "deprecatedlib", | ||
| "version": "0.0.1", | ||
| "scripts": { | ||
| "build": "rescript-legacy build", | ||
| "clean": "rescript clean" | ||
| }, | ||
| "dependencies": { | ||
| "rescript": "workspace:^" | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "deprecatedlib", | ||
| "sources": { "dir": "src", "subdirs": true }, | ||
| "package-specs": { "module": "commonjs", "in-source": true }, | ||
| "suffix": ".res.js" | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| @deprecated({ | ||
| reason: "Use `newThing` instead.", | ||
| migrate: DeprecatedDep.newThing(), | ||
| }) | ||
| let oldThing = () => 1 | ||
|
|
||
| let newThing = () => 2 |
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
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
2 changes: 2 additions & 0 deletions
2
tests/tools_tests/src/expected/DependencyDeprecation.res.expected
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| let value = DeprecatedDep.oldThing() | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| let meaningOfLife = 42 | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| let value = DeprecatedDep.oldThing() |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| let meaningOfLife = 42 |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| val migrate : | ||
| entryPointFile:string -> | ||
| ?dependency_paths:Analysis.SharedTypes.FileSet.t -> | ||
| ?package:Analysis.SharedTypes.package -> | ||
| outputMode:[`File | `Stdout] -> | ||
| (string, string) result | ||
| string -> | ||
| ([`Changed of string | `Unchanged of string], string) result | ||
|
|
||
| val filter_deprecations_for_project : | ||
| ?dependency_paths:Analysis.SharedTypes.FileSet.t -> | ||
| ?package:Analysis.SharedTypes.package -> | ||
| deprecated_used:Cmt_utils.deprecated_used list -> | ||
| string -> | ||
| Cmt_utils.deprecated_used list |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The short-circuit only checks whether
deprecated_usedis empty, but that list is populated for any@deprecateduse, even when bothmigration_templateandmigration_in_pipe_chain_templateareNone. In that case the code still parses/prints the file and will mark it asChangedif the printer normalizes formatting, even though no migration can be applied. This reintroduces the “format-only” rewrite the change is trying to prevent for files that only hit non‑migratable deprecations; consider filtering to entries that actually carry a migration template before deciding to parse/print.Useful? React with 👍 / 👎.