mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #84390 from hamishknight/out-of-place
[Sema] Reject placeholders in type resolution for param and result types
This commit is contained in:
@@ -4863,10 +4863,6 @@ NOTE(descriptive_generic_type_declared_here,none,
|
||||
|
||||
ERROR(placeholder_type_not_allowed,none,
|
||||
"type placeholder not allowed here", ())
|
||||
ERROR(placeholder_type_not_allowed_in_return_type,none,
|
||||
"type placeholder may not appear in function return type", ())
|
||||
ERROR(placeholder_type_not_allowed_in_parameter,none,
|
||||
"type placeholder may not appear in top-level parameter", ())
|
||||
ERROR(placeholder_type_not_allowed_in_pattern,none,
|
||||
"placeholder type may not appear as type of a variable", ())
|
||||
NOTE(replace_placeholder_with_inferred_type,none,
|
||||
|
||||
@@ -117,12 +117,6 @@ private:
|
||||
#define SINGLETON_TYPE(SHORT_ID, ID) TRIVIAL_CASE(ID##Type)
|
||||
#include "swift/AST/TypeNodes.def"
|
||||
|
||||
bool visitPlaceholderType(CanPlaceholderType firstType, Type secondType,
|
||||
Type sugaredFirstType) {
|
||||
// Placeholder types never match.
|
||||
return mismatch(firstType.getPointer(), secondType, sugaredFirstType);
|
||||
}
|
||||
|
||||
bool visitUnresolvedType(CanUnresolvedType firstType, Type secondType,
|
||||
Type sugaredFirstType) {
|
||||
// Unresolved types never match.
|
||||
|
||||
@@ -362,9 +362,6 @@ enum class FixKind : uint8_t {
|
||||
/// resolved.
|
||||
SpecifyTypeForPlaceholder,
|
||||
|
||||
/// Ignore an invalid placeholder in a decl's interface type.
|
||||
IgnoreInvalidPlaceholderInDeclRef,
|
||||
|
||||
/// Allow Swift -> C pointer conversion in an argument position
|
||||
/// of a Swift function.
|
||||
AllowSwiftToCPointerConversion,
|
||||
@@ -3194,30 +3191,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class IgnoreInvalidPlaceholderInDeclRef final : public ConstraintFix {
|
||||
IgnoreInvalidPlaceholderInDeclRef(ConstraintSystem &cs,
|
||||
ConstraintLocator *locator)
|
||||
: ConstraintFix(cs, FixKind::IgnoreInvalidPlaceholderInDeclRef, locator) {}
|
||||
|
||||
public:
|
||||
std::string getName() const override {
|
||||
return "ignore invalid placeholder in decl ref";
|
||||
}
|
||||
|
||||
bool diagnose(const Solution &solution, bool asNote = false) const override;
|
||||
|
||||
bool diagnoseForAmbiguity(CommonFixesArray commonFixes) const override {
|
||||
return diagnose(*commonFixes.front().first);
|
||||
}
|
||||
|
||||
static IgnoreInvalidPlaceholderInDeclRef *create(ConstraintSystem &cs,
|
||||
ConstraintLocator *locator);
|
||||
|
||||
static bool classof(const ConstraintFix *fix) {
|
||||
return fix->getKind() == FixKind::IgnoreInvalidPlaceholderInDeclRef;
|
||||
}
|
||||
};
|
||||
|
||||
class AllowRefToInvalidDecl final : public ConstraintFix {
|
||||
AllowRefToInvalidDecl(ConstraintSystem &cs, ConstraintLocator *locator)
|
||||
: ConstraintFix(cs, FixKind::AllowRefToInvalidDecl, locator) {}
|
||||
|
||||
Reference in New Issue
Block a user