diff --git a/include/swift/AST/ASTBridging.h b/include/swift/AST/ASTBridging.h index df0e5dac3b1..90c6ae857e6 100644 --- a/include/swift/AST/ASTBridging.h +++ b/include/swift/AST/ASTBridging.h @@ -1171,9 +1171,9 @@ BridgedSwiftNativeObjCRuntimeBaseAttr_createParsed(BridgedASTContext cContext, swift::SourceRange range, swift::Identifier name); -SWIFT_NAME("BridgedWarnAttr.createParsed(_:atLoc:range:diagGroupName:behavior:reason:)") -BridgedWarnAttr -BridgedWarnAttr_createParsed(BridgedASTContext cContext, +SWIFT_NAME("BridgedDiagnoseAttr.createParsed(_:atLoc:range:diagGroupName:behavior:reason:)") +BridgedDiagnoseAttr +BridgedDiagnoseAttr_createParsed(BridgedASTContext cContext, swift::SourceLoc atLoc, swift::SourceRange range, swift::Identifier diagGroupName, diff --git a/include/swift/AST/Attr.h b/include/swift/AST/Attr.h index c6e6d75719a..ec5531ef24c 100644 --- a/include/swift/AST/Attr.h +++ b/include/swift/AST/Attr.h @@ -3680,17 +3680,17 @@ public: } }; -class WarnAttr : public DeclAttribute { +class DiagnoseAttr : public DeclAttribute { public: - WarnAttr(DiagGroupID DiagnosticGroupID, WarningGroupBehavior Behavior, + DiagnoseAttr(DiagGroupID DiagnosticGroupID, WarningGroupBehavior Behavior, std::optional Reason, SourceLoc AtLoc, SourceRange Range, bool Implicit) - : DeclAttribute(DeclAttrKind::Warn, AtLoc, Range, Implicit), + : DeclAttribute(DeclAttrKind::Diagnose, AtLoc, Range, Implicit), DiagnosticBehavior(Behavior), DiagnosticGroupID(DiagnosticGroupID), Reason(Reason) {} - WarnAttr(DiagGroupID DiagnosticGroupID, WarningGroupBehavior Behavior, bool Implicit) - : WarnAttr(DiagnosticGroupID, Behavior, std::nullopt, SourceLoc(), + DiagnoseAttr(DiagGroupID DiagnosticGroupID, WarningGroupBehavior Behavior, bool Implicit) + : DiagnoseAttr(DiagnosticGroupID, Behavior, std::nullopt, SourceLoc(), SourceRange(), Implicit) {} WarningGroupBehavior DiagnosticBehavior; @@ -3698,15 +3698,15 @@ public: const std::optional Reason; static bool classof(const DeclAttribute *DA) { - return DA->getKind() == DeclAttrKind::Warn; + return DA->getKind() == DeclAttrKind::Diagnose; } - WarnAttr *clone(ASTContext &ctx) const { - return new (ctx) WarnAttr(DiagnosticGroupID, DiagnosticBehavior, Reason, + DiagnoseAttr *clone(ASTContext &ctx) const { + return new (ctx) DiagnoseAttr(DiagnosticGroupID, DiagnosticBehavior, Reason, AtLoc, Range, isImplicit()); } - bool isEquivalent(const WarnAttr *other, + bool isEquivalent(const DiagnoseAttr *other, Decl *attachedTo) const { return Reason == other->Reason; } diff --git a/include/swift/AST/DeclAttr.def b/include/swift/AST/DeclAttr.def index daeadbcb98f..be878e98ffe 100644 --- a/include/swift/AST/DeclAttr.def +++ b/include/swift/AST/DeclAttr.def @@ -917,12 +917,11 @@ SIMPLE_DECL_ATTR(_unsafeSelfDependentResult, UnsafeSelfDependentResult, UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIBreakingToRemove | EquivalentInABIAttr, 173) -DECL_ATTR(warn, Warn, +DECL_ATTR(diagnose, Diagnose, OnFunc | OnConstructor | OnDestructor | OnSubscript | OnVar | OnNominalType | OnExtension | OnEnumElement | OnAccessor | OnImport | OnTypeAlias | OnAssociatedType | OnMacro, AllowMultipleAttributes | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove | ForbiddenInABIAttr, 174) - -LAST_DECL_ATTR(Warn) +LAST_DECL_ATTR(Diagnose) #undef DECL_ATTR_ALIAS #undef CONTEXTUAL_DECL_ATTR_ALIAS diff --git a/include/swift/AST/DiagnosticsParse.def b/include/swift/AST/DiagnosticsParse.def index 529738afed4..8751e58020b 100644 --- a/include/swift/AST/DiagnosticsParse.def +++ b/include/swift/AST/DiagnosticsParse.def @@ -1770,11 +1770,11 @@ WARNING(attr_warn_unused_result_removed,none, ERROR(attr_warn_unused_result_expected_rparen,none, "expected ')' after 'warn_unused_result' attribute", ()) -// warn -WARNING(attr_warn_unknown_diagnostic_group_identifier,none, +// diagnose +WARNING(attr_diagnose_unknown_diagnostic_group_identifier,none, "the diagnostic group identifier '%0' is unknown", (StringRef)) -ERROR(attr_warn_expected_known_behavior,none, +ERROR(attr_diagnose_expected_known_behavior,none, "expected diagnostic behavior argument '%0' to be either 'error', 'warning' or 'ignored'", (StringRef)) // _specialize diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index ffd37fcb005..a734cbe82f9 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -5648,8 +5648,8 @@ public: printFoot(); } - void visitWarnAttr(WarnAttr *Attr, Label label) { - printCommon(Attr, "warn", label); + void visitDiagnoseAttr(DiagnoseAttr *Attr, Label label) { + printCommon(Attr, "diagnose", label); auto &diagGroupInfo = getDiagGroupInfoByID(Attr->DiagnosticGroupID); printFieldRaw([&](raw_ostream &out) { out << diagGroupInfo.name; }, Label::always("diagGroupID:")); diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 0b6d9348e9f..a1080ebe518 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -472,6 +472,7 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint, DeclAttrKind::RestatedObjCConformance, DeclAttrKind::NonSendable, DeclAttrKind::AllowFeatureSuppression, + DeclAttrKind::Diagnose, }; return result; diff --git a/lib/AST/Attr.cpp b/lib/AST/Attr.cpp index 80d0177dec4..5c866e5ad7a 100644 --- a/lib/AST/Attr.cpp +++ b/lib/AST/Attr.cpp @@ -1338,14 +1338,14 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options, Printer << "(\"" << cast(this)->Name << "\")"; break; - case DeclAttrKind::Warn: { - auto warnAttr = cast(this); - Printer.printAttrName("@warn("); - - auto &diagGroupInfo = getDiagGroupInfoByID(warnAttr->DiagnosticGroupID); + case DeclAttrKind::Diagnose: { + auto diagnoseAttr = cast(this); + Printer.printAttrName("@diagnose("); + + auto &diagGroupInfo = getDiagGroupInfoByID(diagnoseAttr->DiagnosticGroupID); Printer.printText(diagGroupInfo.name); Printer << ", "; - switch (cast(this)->DiagnosticBehavior) { + switch (cast(this)->DiagnosticBehavior) { case WarningGroupBehavior::None: case WarningGroupBehavior::AsWarning: Printer << "as: warning"; @@ -1357,8 +1357,8 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options, Printer << "as: ignored"; break; } - if (cast(this)->Reason) { - Printer << ", \"" << *(cast(this)->Reason) << "\""; + if (cast(this)->Reason) { + Printer << ", \"" << *(cast(this)->Reason) << "\""; } Printer <<")"; } @@ -2054,8 +2054,8 @@ StringRef DeclAttribute::getAttrName() const { return "_rawLayout"; case DeclAttrKind::Extern: return "_extern"; - case DeclAttrKind::Warn: - return "warn"; + case DeclAttrKind::Diagnose: + return "diagnose"; case DeclAttrKind::AllowFeatureSuppression: if (cast(this)->getInverted()) { return "_disallowFeatureSuppression"; diff --git a/lib/AST/Bridging/DeclAttributeBridging.cpp b/lib/AST/Bridging/DeclAttributeBridging.cpp index a7b5f547c3f..d7092e42d58 100644 --- a/lib/AST/Bridging/DeclAttributeBridging.cpp +++ b/lib/AST/Bridging/DeclAttributeBridging.cpp @@ -500,8 +500,8 @@ BridgedSwiftNativeObjCRuntimeBaseAttr_createParsed(BridgedASTContext cContext, SwiftNativeObjCRuntimeBaseAttr(name, atLoc, range, /*Implicit=*/false); } -BridgedWarnAttr -BridgedWarnAttr_createParsed(BridgedASTContext cContext, +BridgedDiagnoseAttr +BridgedDiagnoseAttr_createParsed(BridgedASTContext cContext, SourceLoc atLoc, SourceRange range, Identifier diagGroupName, @@ -509,7 +509,7 @@ BridgedWarnAttr_createParsed(BridgedASTContext cContext, BridgedStringRef reason) { ASTContext &context = cContext.unbridged(); auto diagGroupID = getDiagGroupIDByName(diagGroupName.str()); - + WarningGroupBehavior attrBehavior; switch (behavior) { case None: @@ -523,12 +523,12 @@ BridgedWarnAttr_createParsed(BridgedASTContext cContext, attrBehavior = WarningGroupBehavior::Ignored; break; } - + std::optional reasonText = std::nullopt; if (!reason.getIsEmpty()) reasonText = context.AllocateCopy(reason.unbridged()); - return new (context) WarnAttr(*diagGroupID, attrBehavior, + return new (context) DiagnoseAttr(*diagGroupID, attrBehavior, reasonText, atLoc, range, /*Implicit=*/false); } diff --git a/lib/AST/FeatureSet.cpp b/lib/AST/FeatureSet.cpp index 7dd76a8f084..652d8ee2ad7 100644 --- a/lib/AST/FeatureSet.cpp +++ b/lib/AST/FeatureSet.cpp @@ -447,7 +447,9 @@ static bool usesFeatureConcurrencySyntaxSugar(Decl *decl) { } static bool usesFeatureSourceWarningControl(Decl *decl) { - return decl->getAttrs().hasAttribute(); + // @diagnose is excluded from module interfaces since it only + // affects local diagnostic behavior, so it never needs a feature guard. + return false; } static bool usesFeatureCompileTimeValues(Decl *decl) { diff --git a/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift b/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift index f89e6a92110..27cddcaf8e6 100644 --- a/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift +++ b/lib/ASTGen/Sources/ASTGen/DeclAttrs.swift @@ -198,8 +198,8 @@ extension ASTGenVisitor { return handle(self.generateStorageRestrictionAttr(attribute: node)?.asDeclAttribute) case .SwiftNativeObjCRuntimeBase: return handle(self.generateSwiftNativeObjCRuntimeBaseAttr(attribute: node)?.asDeclAttribute) - case .Warn: - return handle(self.generateWarnAttr(attribute: node)?.asDeclAttribute) + case .Diagnose: + return handle(self.generateDiagnoseAttr(attribute: node)?.asDeclAttribute) case .Transpose: return handle(self.generateTransposeAttr(attribute: node)?.asDeclAttribute) case .TypeEraser: @@ -228,6 +228,9 @@ extension ASTGenVisitor { case nil where attrName == "_versioned": // TODO: Diagnose. return handle(self.generateSimpleDeclAttr(attribute: node, kind: .UsableFromInline)) + case nil where attrName == "warn": + // TODO: Diagnose. 'warn' is renamed to 'diagnose' + return handle(self.generateDiagnoseAttr(attribute: node)?.asDeclAttribute) // Simple attributes. case .AddressableSelf, @@ -2182,9 +2185,9 @@ extension ASTGenVisitor { /// E.g.: /// ``` - /// @warn(DiagGroupID, as: Behavior, reason: String?) + /// @diagnose(DiagGroupID, as: Behavior, reason: String?) /// ``` - func generateWarnAttr(attribute node: AttributeSyntax) -> BridgedWarnAttr? { + func generateDiagnoseAttr(attribute node: AttributeSyntax) -> BridgedDiagnoseAttr? { guard let diagGroupIdentifier: swift.Identifier = self.generateWithLabeledExprListArguments(attribute: node, { args in self.generateConsumingAttrOption(args: &args, label: nil) { expr in guard let declRefExpr = expr.as(DeclReferenceExprSyntax.self) else { diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 07648d59236..4b858df6a1c 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -3252,7 +3252,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes, break; } - case DeclAttrKind::Warn: { + case DeclAttrKind::Diagnose: { if (!consumeIfAttributeLParen()) { diagnose(Loc, diag::attr_expected_lparen, AttrName, DeclAttribute::isDeclModifier(DK)); @@ -3267,13 +3267,13 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes, } auto DiagGroupID = getDiagGroupIDByName(ParsedCategoryIdentifier); if (!DiagGroupID) { - diagnose(Loc, diag::attr_warn_unknown_diagnostic_group_identifier, + diagnose(Loc, diag::attr_diagnose_unknown_diagnostic_group_identifier, ParsedCategoryIdentifier); DiscardAttribute = true; } if (!consumeIf(tok::comma)) { - diagnose(Tok, diag::attr_expected_comma, "@warn", false); + diagnose(Tok, diag::attr_expected_comma, AttrName, false); return makeParserSuccess(); } @@ -3288,7 +3288,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes, diagnose(Loc, diag::attr_expected_colon_after_label, AsLabel.str()); return makeParserSuccess(); } - // Map the behavior identifier to WarnAttr::Behavior + // Map the behavior identifier to DiagnoseAttr::Behavior StringRef ParsedBehaviorIdentifier = Tok.getText(); if (!consumeIf(tok::identifier)) { diagnose(Loc, diag::attr_expected_option_identifier, AttrName); @@ -3302,7 +3302,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes, .Case("ignored", WarningGroupBehavior::Ignored) .Default(std::nullopt); if (!BehaviorSpecifier) { - diagnose(Loc, diag::attr_warn_expected_known_behavior, + diagnose(Loc, diag::attr_diagnose_expected_known_behavior, ParsedBehaviorIdentifier); DiscardAttribute = true; } @@ -3339,7 +3339,7 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes, } if (!DiscardAttribute) - Attributes.add(new (Context) WarnAttr(*DiagGroupID, *BehaviorSpecifier, + Attributes.add(new (Context) DiagnoseAttr(*DiagGroupID, *BehaviorSpecifier, ReasonString, AtLoc, AttrRange, /*Implicit=*/false)); break; @@ -4476,6 +4476,10 @@ ParserStatus Parser::parseDeclAttribute(DeclAttributes &Attributes, checkInvalidAttrName("_used", "used", DeclAttrKind::Used, diag::attr_renamed_warning); + // Historical name for @diagnose. + checkInvalidAttrName("warn", "diagnose", DeclAttrKind::Diagnose, + diag::attr_renamed_warning); + // Historical name for 'nonisolated'. if (!DK && Tok.getText() == "actorIndependent") { diagnose( diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index e3c3056a360..fa4d3d08423 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -222,7 +222,7 @@ public: IGNORED_ATTR(AllowFeatureSuppression) IGNORED_ATTR(PreInverseGenerics) IGNORED_ATTR(Safe) - IGNORED_ATTR(Warn) + IGNORED_ATTR(Diagnose) #undef IGNORED_ATTR void visitABIAttr(ABIAttr *attr) { diff --git a/lib/Sema/TypeCheckDeclOverride.cpp b/lib/Sema/TypeCheckDeclOverride.cpp index fc562dcc917..47100bd326f 100644 --- a/lib/Sema/TypeCheckDeclOverride.cpp +++ b/lib/Sema/TypeCheckDeclOverride.cpp @@ -1766,7 +1766,7 @@ namespace { UNINTERESTING_ATTR(Safe) UNINTERESTING_ATTR(AddressableForDependencies) UNINTERESTING_ATTR(UnsafeSelfDependentResult) - UNINTERESTING_ATTR(Warn) + UNINTERESTING_ATTR(Diagnose) #undef UNINTERESTING_ATTR void visitABIAttr(ABIAttr *attr) { diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index 59924660ae4..ab105939ad4 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0; /// describe what change you made. The content of this comment isn't important; /// it just ensures a conflict if two people change the module format. /// Don't worry about adhering to the 80-column limit for this line. -const uint16_t SWIFTMODULE_VERSION_MINOR = 997; // ActorIsolation::Kind: split Nonisolated from NonisolatedConcurrent +const uint16_t SWIFTMODULE_VERSION_MINOR = 998; // rename '@warn' -> '@diagnose' /// A standard hash seed used for all string hashes in a serialized module. /// @@ -2377,8 +2377,8 @@ namespace decls_block { TypeIDField // result type >; - using WarnDeclAttrLayout = BCRecordLayout< - Warn_DECL_ATTR, + using DiagnoseDeclAttrLayout = BCRecordLayout< + Diagnose_DECL_ATTR, BCFixed<1> // implicit flag >; diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index 19eb79e09d4..e8c98e0c003 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -3047,7 +3047,7 @@ class Serializer::DeclSerializer : public DeclVisitor { case DeclAttrKind::ClangImporterSynthesizedType: case DeclAttrKind::PrivateImport: case DeclAttrKind::AllowFeatureSuppression: - case DeclAttrKind::Warn: + case DeclAttrKind::Diagnose: llvm_unreachable("cannot serialize attribute"); #define SIMPLE_DECL_ATTR(_, CLASS, ...) \ diff --git a/test/IDE/complete_decl_attribute.swift b/test/IDE/complete_decl_attribute.swift index dd13660fbc4..5888ac8e670 100644 --- a/test/IDE/complete_decl_attribute.swift +++ b/test/IDE/complete_decl_attribute.swift @@ -126,7 +126,7 @@ actor MyGenericGlobalActor { // KEYWORD2-NEXT: Keyword/None: lifetime[#Func Attribute#]; name=lifetime // KEYWORD2-NEXT: Keyword/None: abi[#Func Attribute#]; name=abi{{$}} // KEYWORD2-NEXT: Keyword/None: concurrent[#Func Attribute#]; name=concurrent -// KEYWORD2-NEXT: Keyword/None: warn[#Func Attribute#]; name=warn +// KEYWORD2-NEXT: Keyword/None: diagnose[#Func Attribute#]; name=diagnose // KEYWORD2-NOT: Keyword // KEYWORD2-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // KEYWORD2-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper @@ -202,7 +202,7 @@ actor MyGenericGlobalActor { // ON_GLOBALVAR-DAG: Keyword/None: preconcurrency[#Var Attribute#]; name=preconcurrency // ON_GLOBALVAR-DAG: Keyword/None: backDeployed[#Var Attribute#]; name=backDeployed // ON_GLOBALVAR-DAG: Keyword/None: concurrent[#Var Attribute#]; name=concurrent -// ON_GLOBALVAR-DAG: Keyword/None: warn[#Var Attribute#]; name=warn +// ON_GLOBALVAR-DAG: Keyword/None: diagnose[#Var Attribute#]; name=diagnose // ON_GLOBALVAR-NOT: Keyword // ON_GLOBALVAR-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // ON_GLOBALVAR-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper @@ -243,7 +243,7 @@ struct _S { // ON_PROPERTY-DAG: Keyword/None: preconcurrency[#Var Attribute#]; name=preconcurrency // ON_PROPERTY-DAG: Keyword/None: backDeployed[#Var Attribute#]; name=backDeployed // ON_PROPERTY-DAG: Keyword/None: concurrent[#Var Attribute#]; name=concurrent -// ON_PROPERTY-DAG: Keyword/None: warn[#Var Attribute#]; name=warn +// ON_PROPERTY-DAG: Keyword/None: diagnose[#Var Attribute#]; name=diagnose // ON_PROPERTY-NOT: Keyword // ON_PROPERTY-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // ON_PROPERTY-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper @@ -280,7 +280,7 @@ struct _S { // ON_METHOD-DAG: Keyword/None: backDeployed[#Func Attribute#]; name=backDeployed // ON_METHOD-DAG: Keyword/None: lifetime[#Func Attribute#]; name=lifetime // ON_METHOD-DAG: Keyword/None: concurrent[#Func Attribute#]; name=concurrent -// ON_METHOD-DAG: Keyword/None: warn[#Func Attribute#]; name=warn +// ON_METHOD-DAG: Keyword/None: diagnose[#Func Attribute#]; name=diagnose // ON_METHOD-NOT: Keyword // ON_METHOD-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // ON_METHOD-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper @@ -357,7 +357,7 @@ struct _S { // ON_MEMBER_LAST-DAG: Keyword/None: storageRestrictions[#Declaration Attribute#]; name=storageRestrictions // ON_MEMBER_LAST-DAG: Keyword/None: lifetime[#Declaration Attribute#]; name=lifetime // ON_MEMBER_LAST-DAG: Keyword/None: concurrent[#Declaration Attribute#]; name=concurrent -// ON_MEMBER_LAST-DAG: Keyword/None: warn[#Declaration Attribute#]; name=warn +// ON_MEMBER_LAST-DAG: Keyword/None: diagnose[#Declaration Attribute#]; name=diagnose // ON_MEMBER_LAST-NOT: Keyword // ON_MEMBER_LAST-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // ON_MEMBER_LAST-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyPropertyWrapper[#Property Wrapper#]; name=MyPropertyWrapper @@ -434,7 +434,7 @@ func dummy2() {} // KEYWORD_LAST-DAG: Keyword/None: storageRestrictions[#Declaration Attribute#]; name=storageRestrictions // KEYWORD_LAST-DAG: Keyword/None: lifetime[#Declaration Attribute#]; name=lifetime // KEYWORD_LAST-DAG: Keyword/None: concurrent[#Declaration Attribute#]; name=concurrent -// KEYWORD_LAST-DAG: Keyword/None: warn[#Declaration Attribute#]; name=warn +// KEYWORD_LAST-DAG: Keyword/None: diagnose[#Declaration Attribute#]; name=diagnose // KEYWORD_LAST-NOT: Keyword // KEYWORD_LAST-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // KEYWORD_LAST-DAG: Decl[Struct]/CurrModule/TypeRelation[Convertible]: MyGenericPropertyWrapper[#Property Wrapper#]; name=MyGenericPropertyWrapper diff --git a/test/ModuleInterface/diagnose_attr.swift b/test/ModuleInterface/diagnose_attr.swift new file mode 100644 index 00000000000..07eaa0ec3be --- /dev/null +++ b/test/ModuleInterface/diagnose_attr.swift @@ -0,0 +1,31 @@ +// REQUIRES: swift_feature_SourceWarningControl + +// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name DiagnoseAttrTest \ +// RUN: -enable-experimental-feature SourceWarningControl +// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name DiagnoseAttrTest +// RUN: %FileCheck %s < %t.swiftinterface + +// The @diagnose attribute should not appear anywhere in the interface. +// CHECK-NOT: @diagnose +// CHECK: public func usesAsDiagnoseWarning() -> Swift +// CHECK-NOT: @diagnose +// CHECK: public func usesAsDiagnoseIgnored() -> Swift +// CHECK-NOT: @diagnose +// CHECK: public struct DiagnoseOnType { +// CHECK-NOT: @diagnose + +@available(*, deprecated) +public func deprecatedFunc() -> Int { return 0 } + +@diagnose(DeprecatedDeclaration, as: warning) +public func usesAsDiagnoseWarning() -> Int { + return deprecatedFunc() +} + +@diagnose(DeprecatedDeclaration, as: ignored) +public func usesAsDiagnoseIgnored() -> Int { + return deprecatedFunc() +} + +@diagnose(DeprecatedDeclaration, as: ignored) +public struct DiagnoseOnType {} diff --git a/test/Parse/warn_attr_misc.swift b/test/Parse/diagnose_attr_misc.swift similarity index 62% rename from test/Parse/warn_attr_misc.swift rename to test/Parse/diagnose_attr_misc.swift index dcfdc1a670a..023518ebec3 100644 --- a/test/Parse/warn_attr_misc.swift +++ b/test/Parse/diagnose_attr_misc.swift @@ -1,29 +1,29 @@ // REQUIRES: swift_feature_SourceWarningControl // RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl -@warn(ExistentialAny, as: error) +@diagnose(ExistentialAny, as: error) import Swift struct garply: ~Copyable { - @warn(ExistentialAny, as: ignored) + @diagnose(ExistentialAny, as: ignored) init() {} - @warn(ExistentialAny, as: ignored) + @diagnose(ExistentialAny, as: ignored) subscript(index: Int) -> Int { return 11 } - @warn(ExistentialAny, as: ignored) + @diagnose(ExistentialAny, as: ignored) var computedProperty: Int { return 11 } var property: Int { - @warn(ExistentialAny, as: error) + @diagnose(ExistentialAny, as: error) get { return 11 } - @warn(ExistentialAny, as: warning) + @diagnose(ExistentialAny, as: warning) set { let _ = 11 } diff --git a/test/Parse/diagnose_attr_nominal.swift b/test/Parse/diagnose_attr_nominal.swift new file mode 100644 index 00000000000..c457625b1d0 --- /dev/null +++ b/test/Parse/diagnose_attr_nominal.swift @@ -0,0 +1,22 @@ +// REQUIRES: swift_feature_SourceWarningControl +// RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl + +@diagnose(ExistentialAny, as: error) +class Foo {} + +@diagnose(ExistentialAny, as: ignored) +struct Bar {} + +@diagnose(ExistentialAny, as: warning) +enum Baz {} + +@diagnose(ExistentialAny, as: error) +actor Qux { + @diagnose(ExistentialAny, as: ignored) + struct Quux {} +} +@diagnose(ExistentialAny, as: warning) +protocol Corge {} + +@diagnose(ExistentialAny, as: ignored) +extension Bar {} diff --git a/test/Parse/diagnose_attribute.swift b/test/Parse/diagnose_attribute.swift new file mode 100644 index 00000000000..69a518ae8b2 --- /dev/null +++ b/test/Parse/diagnose_attribute.swift @@ -0,0 +1,31 @@ +// REQUIRES: swift_feature_SourceWarningControl +// RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl + +@diagnose(DeprecatedDeclaration, as: error) +func foo() {} + +@diagnose(Deprecate, as: warning) // expected-warning {{the diagnostic group identifier 'Deprecate' is unknown}} +func bar() {} + +@diagnose(DeprecatedDeclaration, as: what) // expected-error {{expected diagnostic behavior argument 'what' to be either 'error', 'warning' or 'ignored'}} +func baz() {} + +// expected-warning @+1 {{the diagnostic group identifier 'Hmm' is unknown}} +@diagnose(Hmm, as: what) // expected-error {{expected diagnostic behavior argument 'what' to be either 'error', 'warning' or 'ignored'}} +func qux() {} + +@diagnose(ExistentialAny, as: ignored, reason: "for a lit test") +func quux() {} + +@diagnose(ExistentialAny, as: ignored, reason: BadReason) // expected-error {{expected string literal in 'diagnose' attribute}} +func corge() {} + +// Backward compatibility: @warn is an alias for @diagnose +@warn(DeprecatedDeclaration, as: error) // expected-warning {{'@warn' has been renamed to '@diagnose'}} +func warnAlias() {} + +@warn(ExistentialAny, as: ignored, reason: "backward compat test") // expected-warning {{'@warn' has been renamed to '@diagnose'}} +func warnAliasWithReason() {} + +@warn(ExistentialAny, as: ignored, reason: BadReason) // expected-warning {{'@warn' has been renamed to '@diagnose'}} expected-error {{expected string literal in 'warn' attribute}} +func warnAliasCorge() {} diff --git a/test/Parse/warn_attr_nominal.swift b/test/Parse/warn_attr_nominal.swift deleted file mode 100644 index 20e4a666ac4..00000000000 --- a/test/Parse/warn_attr_nominal.swift +++ /dev/null @@ -1,22 +0,0 @@ -// REQUIRES: swift_feature_SourceWarningControl -// RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl - -@warn(ExistentialAny, as: error) -class Foo {} - -@warn(ExistentialAny, as: ignored) -struct Bar {} - -@warn(ExistentialAny, as: warning) -enum Baz {} - -@warn(ExistentialAny, as: error) -actor Qux { - @warn(ExistentialAny, as: ignored) - struct Quux {} -} -@warn(ExistentialAny, as: warning) -protocol Corge {} - -@warn(ExistentialAny, as: ignored) -extension Bar {} diff --git a/test/Parse/warn_attribute.swift b/test/Parse/warn_attribute.swift deleted file mode 100644 index f391e9d8760..00000000000 --- a/test/Parse/warn_attribute.swift +++ /dev/null @@ -1,21 +0,0 @@ -// REQUIRES: swift_feature_SourceWarningControl -// RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl - -@warn(DeprecatedDeclaration, as: error) -func foo() {} - -@warn(Deprecate, as: warning) // expected-warning {{the diagnostic group identifier 'Deprecate' is unknown}} -func bar() {} - -@warn(DeprecatedDeclaration, as: what) // expected-error {{expected diagnostic behavior argument 'what' to be either 'error', 'warning' or 'ignored'}} -func baz() {} - -// expected-warning @+1 {{the diagnostic group identifier 'Hmm' is unknown}} -@warn(Hmm, as: what) // expected-error {{expected diagnostic behavior argument 'what' to be either 'error', 'warning' or 'ignored'}} -func qux() {} - -@warn(ExistentialAny, as: ignored, reason: "for a lit test") -func quux() {} - -@warn(ExistentialAny, as: ignored, reason: BadReason) // expected-error {{expected string literal in 'warn' attribute}} -func corge() {} diff --git a/test/attr/warn.swift b/test/attr/diagnose.swift similarity index 78% rename from test/attr/warn.swift rename to test/attr/diagnose.swift index f6f97ee8fca..f940325088e 100644 --- a/test/attr/warn.swift +++ b/test/attr/diagnose.swift @@ -4,12 +4,12 @@ @available(*, deprecated) func bar() -> [Int] { return [1,2,3] } -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) func foo() -> [Int] { return bar() // expected-error {{'bar()' is deprecated}} } -@warn(DeprecatedDeclaration, as: ignored) +@diagnose(DeprecatedDeclaration, as: ignored) func baz() -> [Int] { return bar() } diff --git a/test/attr/warn_global_downgrade.swift b/test/attr/diagnose_global_downgrade.swift similarity index 81% rename from test/attr/warn_global_downgrade.swift rename to test/attr/diagnose_global_downgrade.swift index c91fbd273b0..da35bc04b25 100644 --- a/test/attr/warn_global_downgrade.swift +++ b/test/attr/diagnose_global_downgrade.swift @@ -1,12 +1,12 @@ // REQUIRES: swift_feature_SourceWarningControl // RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl -warnings-as-errors -@warn(PerformanceHints, as: warning) +@diagnose(PerformanceHints, as: warning) func foo() -> [Int] { // expected-warning {{Performance: 'foo()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead.}} return [1,2,3] } -@warn(ReturnTypeImplicitCopy, as: ignored) +@diagnose(ReturnTypeImplicitCopy, as: ignored) func bar() -> [Int] { return [1,2,3] } diff --git a/test/attr/warn_global_enable.swift b/test/attr/diagnose_global_enable.swift similarity index 85% rename from test/attr/warn_global_enable.swift rename to test/attr/diagnose_global_enable.swift index 83d8db058cf..14998548d95 100644 --- a/test/attr/warn_global_enable.swift +++ b/test/attr/diagnose_global_enable.swift @@ -1,12 +1,12 @@ // REQUIRES: swift_feature_SourceWarningControl // RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl -@warn(PerformanceHints, as: error) +@diagnose(PerformanceHints, as: error) func foo() -> [Int] { // expected-error {{Performance: 'foo()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead.}} return [1,2,3] } -@warn(ReturnTypeImplicitCopy, as: warning) +@diagnose(ReturnTypeImplicitCopy, as: warning) func bar() -> [Int] { // expected-warning {{Performance: 'bar()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead.}} return [1,2,3] } diff --git a/test/attr/warn_group_inheritance.swift b/test/attr/diagnose_group_inheritance.swift similarity index 92% rename from test/attr/warn_group_inheritance.swift rename to test/attr/diagnose_group_inheritance.swift index faec307bd11..7e81661b9c6 100644 --- a/test/attr/warn_group_inheritance.swift +++ b/test/attr/diagnose_group_inheritance.swift @@ -1,7 +1,7 @@ // REQUIRES: swift_feature_SourceWarningControl // RUN: %target-typecheck-verify-swift -enable-experimental-feature SourceWarningControl -Wwarning PerformanceHints -@warn(ReturnTypeImplicitCopy, as: error) +@diagnose(ReturnTypeImplicitCopy, as: error) func foo() -> [Int] { // expected-error {{Performance: 'foo()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead.}} return [1,2,3] } diff --git a/test/attr/warn_macro_expansion.swift b/test/attr/diagnose_macro_expansion.swift similarity index 83% rename from test/attr/warn_macro_expansion.swift rename to test/attr/diagnose_macro_expansion.swift index 799d3ca0f51..4f3fa16f380 100644 --- a/test/attr/warn_macro_expansion.swift +++ b/test/attr/diagnose_macro_expansion.swift @@ -7,10 +7,10 @@ // Build the macro library // RUN: %host-build-swift -swift-version 5 -emit-library -o %t/%target-library-name(MacroDefinition) -module-name=MacroDefinition %t/macro.swift -// Type check and verify the test itself which applies @warn to a macro expansion expression +// Type check and verify the test itself which applies @diagnose to a macro expansion expression // RUN: %target-swift-frontend -typecheck -verify -enable-experimental-feature SourceWarningControl -load-plugin-library %t/%target-library-name(MacroDefinition) %t/test.swift -// This test verifies that @warn effect applies to everything within a macro expansion, and that @warn attributes within the expanded +// This test verifies that @diagnose effect applies to everything within a macro expansion, and that @warn attributes within the expanded // code can override the expansion-statement control //--- macro.swift @@ -32,7 +32,7 @@ public struct DefineBarTestMacro: DeclarationMacro { } """, """ - @warn(DeprecatedDeclaration, as: ignored) + @diagnose(DeprecatedDeclaration, as: ignored) struct \(context.makeUniqueName("name")) { func hello() -> String { return bar() @@ -53,7 +53,7 @@ func bar() -> String { return "GoodBye" } @freestanding(declaration) macro anonymousTypes() = #externalMacro(module: "MacroDefinition", type: "DefineBarTestMacro") -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) #anonymousTypes() // expected-note {{in expansion of macro 'anonymousTypes' here}} // expected-error@@__swiftmacro_4test0015testswift_tzEGbfMX8_0_33_83378C430F65473055F1BD53F3ADCDB7Ll14anonymousTypesfMf_.swift:3:12{{'bar()' is deprecated}} diff --git a/test/attr/warn_no_feature.swift b/test/attr/diagnose_no_feature.swift similarity index 79% rename from test/attr/warn_no_feature.swift rename to test/attr/diagnose_no_feature.swift index b21533fd6dd..9ae1265400b 100644 --- a/test/attr/warn_no_feature.swift +++ b/test/attr/diagnose_no_feature.swift @@ -5,12 +5,12 @@ func bar() -> [Int] { return [1,2,3] } // Ensure feature SourceWarningControl has no effect until enabled -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) func foo() -> [Int] { return bar() // expected-warning {{'bar()' is deprecated}} } -@warn(DeprecatedDeclaration, as: ignored) +@diagnose(DeprecatedDeclaration, as: ignored) func baz() -> [Int] { return bar() // expected-warning {{'bar()' is deprecated}} } diff --git a/test/attr/warn_peer_macro.swift b/test/attr/diagnose_peer_macro.swift similarity index 88% rename from test/attr/warn_peer_macro.swift rename to test/attr/diagnose_peer_macro.swift index 1cfbbd2986f..8c0abe8b12e 100644 --- a/test/attr/warn_peer_macro.swift +++ b/test/attr/diagnose_peer_macro.swift @@ -10,7 +10,7 @@ // Type check and verify // RUN: %target-swift-frontend -typecheck -verify -enable-experimental-feature SourceWarningControl -load-plugin-library %t/%target-library-name(MacroDefinition) %t/test.swift -// This test verifies that @warn on a declaration does NOT propagate to peer +// This test verifies that @diagnose on a declaration does NOT propagate to peer // declarations generated by an attached peer macro, because peers are // independent siblings, not children of the annotated declaration's scope. @@ -34,7 +34,7 @@ public struct AddCompanionMacro: PeerMacro { } } -/// A companion function with its own @warn. +/// A companion function with its own @diagnose. public struct AddSuppressedCompanionMacro: PeerMacro { public static func expansion( of node: AttributeSyntax, @@ -43,7 +43,7 @@ public struct AddSuppressedCompanionMacro: PeerMacro { ) throws -> [DeclSyntax] { return [ """ - @warn(DeprecatedDeclaration, as: ignored) + @diagnose(DeprecatedDeclaration, as: ignored) func suppressed() -> String { return bar() } @@ -64,10 +64,10 @@ macro AddCompanion() = #externalMacro(module: "MacroDefinition", type: "AddCompa macro AddSuppressedCompanion() = #externalMacro(module: "MacroDefinition", type: "AddSuppressedCompanionMacro") struct TestPeerMacro { - @warn(DeprecatedDeclaration, as: ignored) + @diagnose(DeprecatedDeclaration, as: ignored) @AddCompanion // expected-note {{in expansion of macro 'AddCompanion' on instance method 'original()' here}} func original() -> String { - return bar() // no warning — suppressed by @warn on this declaration + return bar() // no warning — suppressed by @diagnose on this declaration } // expected-warning@@__swiftmacro_4test13TestPeerMacroV8original12AddCompanionfMp_.swift:2:10{{'bar()' is deprecated}} } diff --git a/test/attr/warn_sites.swift b/test/attr/diagnose_sites.swift similarity index 68% rename from test/attr/warn_sites.swift rename to test/attr/diagnose_sites.swift index 9ce2e617b5a..6edcf50ab5c 100644 --- a/test/attr/warn_sites.swift +++ b/test/attr/diagnose_sites.swift @@ -8,21 +8,21 @@ func dep() -> Bool { return false } class depClass {} // Function -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) func foo() { let _: Bool = dep() // expected-error {{'dep()' is deprecated}} - @warn(DeprecatedDeclaration, as: warning) + @diagnose(DeprecatedDeclaration, as: warning) func bar() { let _: Bool = dep() // expected-warning {{'dep()' is deprecated}} - @warn(DeprecatedDeclaration, as: ignored) - @warn(PerformanceHints, as: error) + @diagnose(DeprecatedDeclaration, as: ignored) + @diagnose(PerformanceHints, as: error) func baz() { let _: Bool = dep() } - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) func qux() { let _: Bool = dep() // expected-error {{'dep()' is deprecated}} - @warn(DeprecatedDeclaration, as: warning) + @diagnose(DeprecatedDeclaration, as: warning) func corge() { let _: Bool = dep() // expected-warning {{'dep()' is deprecated}} } @@ -31,84 +31,84 @@ func foo() { } // Nominal types -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) class Foo { let x = dep() // expected-error {{'dep()' is deprecated}} } -@warn(DeprecatedDeclaration, as: ignored) +@diagnose(DeprecatedDeclaration, as: ignored) struct Bar { let x = dep() } -@warn(DeprecatedDeclaration, as: warning) +@diagnose(DeprecatedDeclaration, as: warning) enum Baz { var x: Bool { dep() } // expected-warning {{'dep()' is deprecated}} } -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) actor Qux { let x = dep() // expected-error {{'dep()' is deprecated}} - @warn(DeprecatedDeclaration, as: ignored) + @diagnose(DeprecatedDeclaration, as: ignored) struct Quux { let x = dep() } } -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) protocol Proto { var x: depClass { get } // expected-error {{'depClass' is deprecated}} } // Initializer -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) struct Corge : ~Copyable { let x = dep() // expected-error {{'dep()' is deprecated}} - @warn(DeprecatedDeclaration, as: ignored) + @diagnose(DeprecatedDeclaration, as: ignored) init() { let _ = dep() } - @warn(DeprecatedDeclaration, as: warning) + @diagnose(DeprecatedDeclaration, as: warning) deinit { let _ = dep() // expected-warning {{'dep()' is deprecated}} } } // Extension -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) extension Foo { var y: Bool { dep() } // expected-error {{'dep()' is deprecated}} } // Import -@warn(PreconcurrencyImport, as: error) +@diagnose(PreconcurrencyImport, as: error) @preconcurrency import Swift // expected-error {{'@preconcurrency' on module 'Swift' has no effect}} -@warn(PreconcurrencyImport, as: ignored) +@diagnose(PreconcurrencyImport, as: ignored) @preconcurrency import Swift // Subscript struct Hmm { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) subscript(index: Int) -> Bool { return dep() // expected-error {{'dep()' is deprecated}} } } // Computed property -@warn(DeprecatedDeclaration, as: ignored) +@diagnose(DeprecatedDeclaration, as: ignored) extension Foo { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) var property: Bool { return dep() // expected-error {{'dep()' is deprecated}} } } // Accessors -@warn(DeprecatedDeclaration, as: ignored) +@diagnose(DeprecatedDeclaration, as: ignored) extension Foo { var b: Bool { dep() } var computed_property: Bool { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) get { return dep() // expected-error {{'dep()' is deprecated}} } - @warn(DeprecatedDeclaration, as: warning) + @diagnose(DeprecatedDeclaration, as: warning) set { let _ = dep() // expected-warning {{'dep()' is deprecated}} } @@ -116,14 +116,14 @@ extension Foo { } // Observers -@warn(DeprecatedDeclaration, as: ignored) +@diagnose(DeprecatedDeclaration, as: ignored) struct Foox { var observed_property: Bool { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) willSet { let _ = dep() // expected-error {{'dep()' is deprecated}} } - @warn(DeprecatedDeclaration, as: warning) + @diagnose(DeprecatedDeclaration, as: warning) didSet { let _ = dep() // expected-warning {{'dep()' is deprecated}} } @@ -132,28 +132,28 @@ struct Foox { // Enum case enum UnEnum { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) case foo(depClass) // expected-error {{'depClass' is deprecated}} } // Enum raw value case enum RawEnum: Int32 { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) case foo = 32 } // Typealias -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) typealias Sneaky = depClass // expected-error {{'depClass' is deprecated}} // Associated type protocol P { - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) associatedtype AT: depClass // expected-error {{'depClass' is deprecated}} } // Macro declaration -@warn(DeprecatedDeclaration, as: error) +@diagnose(DeprecatedDeclaration, as: error) @freestanding(declaration, names: named(FooMacro)) macro FooMacro(_ s: depClass) = #externalMacro(module: "Foo", type: "Bar") // expected-error {{'depClass' is deprecated}} // expected-warning@-1 {{external macro implementation type 'Foo.Bar' could not be found for macro 'FooMacro'; plugin for module 'Foo' not found}} @@ -174,15 +174,15 @@ struct depIntClamped { func baz() { @depIntClamped // expected-error {{'depIntClamped' is deprecated}} - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) var score1: Int = 5 - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) @depIntClamped // expected-error {{'depIntClamped' is deprecated}} var score2: Int = 5 - @warn(DeprecatedDeclaration, as: error) + @diagnose(DeprecatedDeclaration, as: error) @depIntClamped // nothing - @warn(DeprecatedDeclaration, as: ignored) + @diagnose(DeprecatedDeclaration, as: ignored) var score3: Int = 5 }