Provide fixit for inferred property of opaque type (#69241) #74811
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.
When a pattern binding at top level attempts to pick up another declaration's opaque result type as its type by type inference, provide a fixit to explicitly declare the type. This is done to prevent opaque result types from propagating nontrivially into other declarations' types, see 6db0540
(First PR in this repo 🙏)
Added fix-it that annotates a top level declaration property declaration of inferred opaque type to be explicitly typed. Reasoning for this requirement in 6db0540.
Resolves #69241
Tests
Reused the 3 existing cases covered in
test/type/opaque.swift
:Test case 1
Is fixed to:
Test case 2
Is fixed to:
Test case 3
Is fixed to