Skip to content

Conversation

hamishknight
Copy link
Contributor

  • Improve the diagnostic for extension _ {}
  • Ban placeholders for typed throws
  • Only allow placeholder return types for FuncDecls with bodies
  • Ban placeholder param types in protocol requirements
  • Ensure we record a fix when referencing a decl with a placeholder interface type to ensure we don't attempt to apply the solution
  • Avoid matching placeholder types in associated type inference

@hamishknight
Copy link
Contributor Author

@swift-ci please test source compatibility

Avoid emitting a diagnostic about `<<hole>>` being a non-nominal type.
This never worked correctly and would crash in SILGen, ban the use
of placeholder types. While here, ensure we replace any ErrorTypes
with holes when solving the closure in the constraint system.
Ensure we can still produce a source location even if there's no name
loc, which is the case for e.g enum associated types.
We allow resolving PlaceholderType here to allow MiscDiagnostics to
suggest replacing it with the inferred result type, but we won't run
that logic for non-FuncDecls and FuncDecls without bodies. Make sure
we reject placeholders in those cases.
We allow placeholder types in interface types in certain cases to allow
better recovery since we can suggest the inferred type as a replacement.
When referencing those decls though we need to make sure we record a fix
since we cannot form a valid solution with them.
We can't ever have default arguments in protocols anyway.
Avoid attempting to infer an associatedtype as a type that contains
placeholders.
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

swiftlang/swift-package-manager#9153

@swift-ci please smoke test Linux

@hamishknight hamishknight merged commit 197bcc2 into swiftlang:main Sep 18, 2025
4 of 5 checks passed
@hamishknight hamishknight deleted the time-and-place branch September 18, 2025 11:51
Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍🏼

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants