diff --git a/include/swift/AST/EducationalNotes.def b/include/swift/AST/EducationalNotes.def index b4595ca8575e4..ca30032f17a5f 100644 --- a/include/swift/AST/EducationalNotes.def +++ b/include/swift/AST/EducationalNotes.def @@ -24,6 +24,19 @@ EDUCATIONAL_NOTES(unsupported_existential_type, "associated-type-requirements.md") +EDUCATIONAL_NOTES(cannot_pass_type_to_non_ephemeral, "temporary-pointers.md") +EDUCATIONAL_NOTES(cannot_pass_type_to_non_ephemeral_warning, + "temporary-pointers.md") +EDUCATIONAL_NOTES(cannot_use_inout_non_ephemeral, + "temporary-pointers.md") +EDUCATIONAL_NOTES(cannot_use_inout_non_ephemeral_warning, + "temporary-pointers.md") +EDUCATIONAL_NOTES(cannot_construct_dangling_pointer, "temporary-pointers.md") +EDUCATIONAL_NOTES(cannot_construct_dangling_pointer_warning, + "temporary-pointers.md") + + + EDUCATIONAL_NOTES(non_nominal_no_initializers, "nominal-types.md") EDUCATIONAL_NOTES(non_nominal_extension, "nominal-types.md") EDUCATIONAL_NOTES(associated_type_witness_conform_impossible, diff --git a/include/swift/IDE/CodeCompletion.h b/include/swift/IDE/CodeCompletion.h index 89a1ea7572416..142fad284ef82 100644 --- a/include/swift/IDE/CodeCompletion.h +++ b/include/swift/IDE/CodeCompletion.h @@ -594,6 +594,7 @@ class CodeCompletionResult { unsigned SemanticContext : 3; unsigned NotRecommended : 1; unsigned NotRecReason : 3; + unsigned IsSystem : 1; /// The number of bytes to the left of the code completion point that /// should be erased first if this completion string is inserted in the @@ -634,6 +635,7 @@ class CodeCompletionResult { assert(!isOperator() || getOperatorKind() != CodeCompletionOperatorKind::None); AssociatedKind = 0; + IsSystem = 0; } /// Constructs a \c Keyword result. @@ -651,6 +653,7 @@ class CodeCompletionResult { TypeDistance(TypeDistance) { assert(CompletionString); AssociatedKind = static_cast(Kind); + IsSystem = 0; } /// Constructs a \c Literal result. @@ -667,6 +670,7 @@ class CodeCompletionResult { NumBytesToErase(NumBytesToErase), CompletionString(CompletionString), TypeDistance(TypeDistance) { AssociatedKind = static_cast(LiteralKind); + IsSystem = 0; assert(CompletionString); } @@ -694,6 +698,7 @@ class CodeCompletionResult { TypeDistance(TypeDistance) { assert(AssociatedDecl && "should have a decl"); AssociatedKind = unsigned(getCodeCompletionDeclKind(AssociatedDecl)); + IsSystem = getDeclIsSystem(AssociatedDecl); assert(CompletionString); if (isOperator()) KnownOperatorKind = @@ -706,8 +711,8 @@ class CodeCompletionResult { CodeCompletionResult(SemanticContextKind SemanticContext, unsigned NumBytesToErase, CodeCompletionString *CompletionString, - CodeCompletionDeclKind DeclKind, StringRef ModuleName, - bool NotRecommended, + CodeCompletionDeclKind DeclKind, bool IsSystem, + StringRef ModuleName, bool NotRecommended, CodeCompletionResult::NotRecommendedReason NotRecReason, StringRef BriefDocComment, ArrayRef AssociatedUSRs, @@ -718,10 +723,10 @@ class CodeCompletionResult { KnownOperatorKind(unsigned(KnownOperatorKind)), SemanticContext(unsigned(SemanticContext)), NotRecommended(NotRecommended), NotRecReason(NotRecReason), - NumBytesToErase(NumBytesToErase), CompletionString(CompletionString), - ModuleName(ModuleName), BriefDocComment(BriefDocComment), - AssociatedUSRs(AssociatedUSRs), DocWords(DocWords), - TypeDistance(TypeDistance) { + IsSystem(IsSystem), NumBytesToErase(NumBytesToErase), + CompletionString(CompletionString), ModuleName(ModuleName), + BriefDocComment(BriefDocComment), AssociatedUSRs(AssociatedUSRs), + DocWords(DocWords), TypeDistance(TypeDistance) { AssociatedKind = static_cast(DeclKind); assert(CompletionString); assert(!isOperator() || @@ -763,6 +768,10 @@ class CodeCompletionResult { return static_cast(KnownOperatorKind); } + bool isSystem() const { + return static_cast(IsSystem); + } + ExpectedTypeRelation getExpectedTypeRelation() const { return static_cast(TypeDistance); } @@ -810,6 +819,7 @@ class CodeCompletionResult { getCodeCompletionOperatorKind(StringRef name); static CodeCompletionOperatorKind getCodeCompletionOperatorKind(CodeCompletionString *str); + static bool getDeclIsSystem(const Decl *D); }; struct CodeCompletionResultSink { diff --git a/lib/AST/GenericSignature.cpp b/lib/AST/GenericSignature.cpp index a0e55c335a459..80a6bb5166fdd 100644 --- a/lib/AST/GenericSignature.cpp +++ b/lib/AST/GenericSignature.cpp @@ -411,7 +411,8 @@ bool GenericSignatureImpl::requiresClass(Type type) { /// Determine the superclass bound on the given dependent type. Type GenericSignatureImpl::getSuperclassBound(Type type) { - if (!type->isTypeParameter()) return nullptr; + assert(type->isTypeParameter() && + "Only type parameters can have superclass requirements"); auto &builder = *getGenericSignatureBuilder(); auto equivClass = @@ -457,8 +458,7 @@ GenericSignatureImpl::getConformsTo(Type type) { } bool GenericSignatureImpl::conformsToProtocol(Type type, ProtocolDecl *proto) { - // FIXME: Deal with concrete conformances here? - if (!type->isTypeParameter()) return false; + assert(type->isTypeParameter() && "Expected a type parameter"); auto &builder = *getGenericSignatureBuilder(); auto equivClass = @@ -562,7 +562,7 @@ bool GenericSignatureImpl::isRequirementSatisfied(Requirement requirement) { // requirement, but it could also be in terms of concrete types if it has // been substituted/otherwise 'resolved', so we need to handle both. auto baseType = canFirstType; - if (canFirstType->isTypeParameter()) { + if (baseType->isTypeParameter()) { auto directSuperclass = getSuperclassBound(baseType); if (!directSuperclass) return false; diff --git a/lib/IDE/CodeCompletion.cpp b/lib/IDE/CodeCompletion.cpp index 8f8f7e873a218..a08aa32d404aa 100644 --- a/lib/IDE/CodeCompletion.cpp +++ b/lib/IDE/CodeCompletion.cpp @@ -539,6 +539,10 @@ CodeCompletionResult::getCodeCompletionDeclKind(const Decl *D) { llvm_unreachable("invalid DeclKind"); } +bool CodeCompletionResult::getDeclIsSystem(const Decl *D) { + return D->getModuleContext()->isSystemModule(); +} + void CodeCompletionResult::printPrefix(raw_ostream &OS) const { llvm::SmallString<64> Prefix; switch (getKind()) { @@ -700,6 +704,8 @@ void CodeCompletionResult::printPrefix(raw_ostream &OS) const { } if (NotRecommended) Prefix.append("/NotRecommended"); + if (IsSystem) + Prefix.append("/IsSystem"); if (NumBytesToErase != 0) { Prefix.append("/Erase["); Prefix.append(Twine(NumBytesToErase).str()); @@ -4714,9 +4720,11 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer { else { auto dist = Ctx.SourceMgr.getByteDistance( introducerLoc, Ctx.SourceMgr.getCodeCompletionLoc()); - Builder.setNumBytesToErase(dist); - Builder.addOverrideKeyword(); - Builder.addDeclIntroducer(DeclStr.str().substr(0, NameOffset)); + if (dist <= CodeCompletionResult::MaxNumBytesToErase) { + Builder.setNumBytesToErase(dist); + Builder.addOverrideKeyword(); + Builder.addDeclIntroducer(DeclStr.str().substr(0, NameOffset)); + } } } diff --git a/lib/IDE/CodeCompletionCache.cpp b/lib/IDE/CodeCompletionCache.cpp index 0e8f9e51edf95..21a3d7aa6700d 100644 --- a/lib/IDE/CodeCompletionCache.cpp +++ b/lib/IDE/CodeCompletionCache.cpp @@ -215,6 +215,7 @@ static bool readCachedModule(llvm::MemoryBuffer *in, auto opKind = static_cast(*cursor++); auto context = static_cast(*cursor++); auto notRecommended = static_cast(*cursor++); + auto isSystem = static_cast(*cursor++); auto numBytesToErase = static_cast(*cursor++); auto oldCursor = cursor; auto chunkIndex = read32le(cursor); @@ -248,7 +249,7 @@ static bool readCachedModule(llvm::MemoryBuffer *in, CodeCompletionResult *result = nullptr; if (kind == CodeCompletionResult::Declaration) { result = new (*V.Sink.Allocator) CodeCompletionResult( - context, numBytesToErase, string, declKind, moduleName, + context, numBytesToErase, string, declKind, isSystem, moduleName, notRecommended, CodeCompletionResult::NotRecommendedReason::NoReason, briefDocComment, copyStringArray(*V.Sink.Allocator, assocUSRs), copyStringPairArray(*V.Sink.Allocator, declKeywords), @@ -371,6 +372,7 @@ static void writeCachedModule(llvm::raw_ostream &out, LE.write(static_cast(CodeCompletionOperatorKind::None)); LE.write(static_cast(R->getSemanticContext())); LE.write(static_cast(R->isNotRecommended())); + LE.write(static_cast(R->isSystem())); LE.write(static_cast(R->getNumBytesToErase())); LE.write( static_cast(addCompletionString(R->getCompletionString()))); diff --git a/lib/IRGen/GenConstant.cpp b/lib/IRGen/GenConstant.cpp index c8bd8efb530e0..6855b0ccadf94 100644 --- a/lib/IRGen/GenConstant.cpp +++ b/lib/IRGen/GenConstant.cpp @@ -56,6 +56,41 @@ llvm::Constant *irgen::emitConstantInt(IRGenModule &IGM, return llvm::ConstantInt::get(IGM.getLLVMContext(), value); } +llvm::Constant *irgen::emitConstantZero(IRGenModule &IGM, BuiltinInst *BI) { + assert(IGM.getSILModule().getBuiltinInfo(BI->getName()).ID == + BuiltinValueKind::ZeroInitializer); + + auto helper = [&](CanType astType) -> llvm::Constant * { + if (auto type = astType->getAs()) { + APInt zero(type->getWidth().getLeastWidth(), 0); + return llvm::ConstantInt::get(IGM.getLLVMContext(), zero); + } + + if (auto type = astType->getAs()) { + const llvm::fltSemantics *sema = nullptr; + switch (type->getFPKind()) { + case BuiltinFloatType::IEEE16: sema = &APFloat::IEEEhalf(); break; + case BuiltinFloatType::IEEE32: sema = &APFloat::IEEEsingle(); break; + case BuiltinFloatType::IEEE64: sema = &APFloat::IEEEdouble(); break; + case BuiltinFloatType::IEEE80: sema = &APFloat::x87DoubleExtended(); break; + case BuiltinFloatType::IEEE128: sema = &APFloat::IEEEquad(); break; + case BuiltinFloatType::PPC128: sema = &APFloat::PPCDoubleDouble(); break; + } + auto zero = APFloat::getZero(*sema); + return llvm::ConstantFP::get(IGM.getLLVMContext(), zero); + } + + llvm_unreachable("SIL allowed an unknown type?"); + }; + + if (auto vector = BI->getType().getAs()) { + auto zero = helper(vector.getElementType()); + return llvm::ConstantVector::getSplat(vector->getNumElements(), zero); + } + + return helper(BI->getType().getASTType()); +} + llvm::Constant *irgen::emitConstantFP(IRGenModule &IGM, FloatLiteralInst *FLI) { return llvm::ConstantFP::get(IGM.getLLVMContext(), FLI->getValue()); } @@ -94,6 +129,8 @@ static llvm::Constant *emitConstantValue(IRGenModule &IGM, SILValue operand) { return emitAddrOfConstantString(IGM, SLI); } else if (auto *BI = dyn_cast(operand)) { switch (IGM.getSILModule().getBuiltinInfo(BI->getName()).ID) { + case BuiltinValueKind::ZeroInitializer: + return emitConstantZero(IGM, BI); case BuiltinValueKind::PtrToInt: { llvm::Constant *ptr = emitConstantValue(IGM, BI->getArguments()[0]); return llvm::ConstantExpr::getPtrToInt(ptr, IGM.IntPtrTy); diff --git a/lib/IRGen/GenConstant.h b/lib/IRGen/GenConstant.h index 3a5c23adb0911..faa67fcc8114f 100644 --- a/lib/IRGen/GenConstant.h +++ b/lib/IRGen/GenConstant.h @@ -27,6 +27,9 @@ namespace irgen { /// Construct a ConstantInt from an IntegerLiteralInst. llvm::Constant *emitConstantInt(IRGenModule &IGM, IntegerLiteralInst *ILI); +/// Construct a zero from a zero intializer BuiltinInst. +llvm::Constant *emitConstantZero(IRGenModule &IGM, BuiltinInst *Bi); + /// Construct a ConstantFP from a FloatLiteralInst. llvm::Constant *emitConstantFP(IRGenModule &IGM, FloatLiteralInst *FLI); diff --git a/lib/SIL/IR/SILGlobalVariable.cpp b/lib/SIL/IR/SILGlobalVariable.cpp index 733ad528dcd52..a7473bbd287e6 100644 --- a/lib/SIL/IR/SILGlobalVariable.cpp +++ b/lib/SIL/IR/SILGlobalVariable.cpp @@ -109,6 +109,12 @@ bool SILGlobalVariable::isValidStaticInitializerInst(const SILInstruction *I, case SILInstructionKind::BuiltinInst: { auto *bi = cast(I); switch (M.getBuiltinInfo(bi->getName()).ID) { + case BuiltinValueKind::ZeroInitializer: { + auto type = bi->getType().getASTType(); + if (auto vector = dyn_cast(type)) + type = vector.getElementType(); + return isa(type) || isa(type); + } case BuiltinValueKind::PtrToInt: if (isa(bi->getArguments()[0])) return true; diff --git a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp index 32207e38f9590..098709c3e541a 100644 --- a/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackEmitter.cpp @@ -1331,6 +1331,7 @@ void PullbackEmitter::visitSILInstruction(SILInstruction *inst) { AllocStackInst * PullbackEmitter::getArrayAdjointElementBuffer(SILValue arrayAdjoint, int eltIndex, SILLocation loc) { + auto &ctx = builder.getASTContext(); auto arrayTanType = cast(arrayAdjoint->getType().getASTType()); auto arrayType = arrayTanType->getParent()->castTo(); auto eltTanType = arrayType->getGenericArgs().front()->getCanonicalType(); @@ -1340,7 +1341,19 @@ PullbackEmitter::getArrayAdjointElementBuffer(SILValue arrayAdjoint, auto *arrayTanStructDecl = arrayTanType->getStructOrBoundGenericStruct(); auto subscriptLookup = arrayTanStructDecl->lookupDirect(DeclBaseName::createSubscript()); - auto *subscriptDecl = cast(subscriptLookup.front()); + SubscriptDecl *subscriptDecl = nullptr; + for (auto *candidate : subscriptLookup) { + auto candidateModule = candidate->getModuleContext(); + if (candidateModule->getName() == ctx.Id_Differentiation || + candidateModule->isStdlibModule()) { + assert(!subscriptDecl && "Multiple `Array.TangentVector.subscript`s"); + subscriptDecl = cast(candidate); +#ifdef NDEBUG + break; +#endif + } + } + assert(subscriptDecl && "No `Array.TangentVector.subscript`"); auto *subscriptGetterDecl = subscriptDecl->getAccessor(AccessorKind::Get); assert(subscriptGetterDecl && "No `Array.TangentVector.subscript` getter"); SILOptFunctionBuilder fb(getContext().getTransform()); @@ -1352,7 +1365,6 @@ PullbackEmitter::getArrayAdjointElementBuffer(SILValue arrayAdjoint, subscriptGetterFn->getLoweredFunctionType()->getSubstGenericSignature(); // Apply `Array.TangentVector.subscript.getter` to get array element adjoint // buffer. - auto &ctx = builder.getASTContext(); // %index_literal = integer_literal $Builtin.IntXX, auto builtinIntType = SILType::getPrimitiveObjectType(ctx.getIntDecl() diff --git a/lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp b/lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp index e68a0ba7cfc5a..6eecc6e3036c4 100644 --- a/lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp +++ b/lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp @@ -452,6 +452,10 @@ SILCombiner::visitThickToObjCMetatypeInst(ThickToObjCMetatypeInst *TTOCMI) { if (CastOpt.optimizeMetatypeConversion(TTOCMI, MetatypeRepresentation::Thick)) MadeChange = true; + if (auto *OCTTMI = dyn_cast(TTOCMI->getOperand())) { + TTOCMI->replaceAllUsesWith(OCTTMI->getOperand()); + return eraseInstFromFunction(*TTOCMI); + } return nullptr; } @@ -472,6 +476,10 @@ SILCombiner::visitObjCToThickMetatypeInst(ObjCToThickMetatypeInst *OCTTMI) { if (CastOpt.optimizeMetatypeConversion(OCTTMI, MetatypeRepresentation::ObjC)) MadeChange = true; + if (auto *TTOCMI = dyn_cast(OCTTMI->getOperand())) { + OCTTMI->replaceAllUsesWith(TTOCMI->getOperand()); + return eraseInstFromFunction(*OCTTMI); + } return nullptr; } diff --git a/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp b/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp index 263af770e1443..0eca4b14568be 100644 --- a/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp +++ b/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp @@ -40,6 +40,11 @@ namespace { // FIXME: Reconcile the similarities between this and // isInstructionTriviallyDead. static bool seemsUseful(SILInstruction *I) { + // begin_access is defined to have side effects, but this is not relevant for + // DCE. + if (isa(I)) + return false; + if (I->mayHaveSideEffects()) return true; @@ -258,6 +263,10 @@ void DCE::markLive(SILFunction &F) { } continue; } + if (auto *endAccess = dyn_cast(&I)) { + addReverseDependency(endAccess->getBeginAccess(), &I); + continue; + } if (seemsUseful(&I)) markValueLive(&I); } diff --git a/stdlib/public/core/Slice.swift b/stdlib/public/core/Slice.swift index 3e2df8edbee09..660334d57e64e 100644 --- a/stdlib/public/core/Slice.swift +++ b/stdlib/public/core/Slice.swift @@ -127,7 +127,7 @@ public struct Slice { /// /// print(singleNonZeroDigits.count) /// // Prints "9" - /// prints(singleNonZeroDigits.base.count) + /// print(singleNonZeroDigits.base.count) /// // Prints "10" /// print(singleDigits == singleNonZeroDigits.base) /// // Prints "true" diff --git a/test/AutoDiff/stdlib/array.swift b/test/AutoDiff/stdlib/array.swift index 0983060cc7ba5..06807cc9c32ee 100644 --- a/test/AutoDiff/stdlib/array.swift +++ b/test/AutoDiff/stdlib/array.swift @@ -8,6 +8,15 @@ var ArrayAutoDiffTests = TestSuite("ArrayAutoDiff") typealias FloatArrayTan = Array.TangentVector +extension Array.DifferentiableView { + /// A subscript that always fatal errors. + /// + /// The differentiation transform should never emit calls to this. + subscript(alwaysFatalError: Int) -> Element { + fatalError("wrong subscript") + } +} + ArrayAutoDiffTests.test("ArrayIdentity") { func arrayIdentity(_ x: [Float]) -> [Float] { return x diff --git a/test/IDE/complete_annotation.swift b/test/IDE/complete_annotation.swift index 0e6b7bdbc0d78..a7151f3d08322 100644 --- a/test/IDE/complete_annotation.swift +++ b/test/IDE/complete_annotation.swift @@ -47,9 +47,9 @@ func testGlobal() { // GLOBAL_EXPR-DAG: Literal[_Image]/None: #imageLiteral(resourceName: String); name=#imageLiteral(resourceName: String) // GLOBAL_EXPR-DAG: Literal[Tuple]/None: (values); name=(values) // GLOBAL_EXPR-DAG: Keyword[#function]/None: #function; name=#function -// GLOBAL_EXPR-DAG: Decl[Module]/None: Swift; name=Swift -// GLOBAL_EXPR-DAG: Decl[Struct]/OtherModule[Swift]: Int; name=Int -// GLOBAL_EXPR-DAG: Decl[FreeFunction]/OtherModule[Swift]: print(_ items: Any..., to output: &TextOutputStream); name=print(items: Any..., to: &TextOutputStream) +// GLOBAL_EXPR-DAG: Decl[Module]/None/IsSystem: Swift; name=Swift +// GLOBAL_EXPR-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int; name=Int +// GLOBAL_EXPR-DAG: Decl[FreeFunction]/OtherModule[Swift]/IsSystem: print(_ items: Any..., to output: &TextOutputStream); name=print(items: Any..., to: &TextOutputStream) // GLOBAL_EXPR: End completions @@ -58,8 +58,8 @@ func testType(value: #^GLOBAL_TYPE^#) {} // GLOBAL_TYPE-DAG: Keyword/None: Any; name=Any // GLOBAL_TYPE-DAG: Decl[Struct]/CurrModule: MyStruct; name=MyStruct // GLOBAL_TYPE-DAG: Decl[Module]/None: swift_ide_test; name=swift_ide_test -// GLOBAL_TYPE-DAG: Decl[Module]/None: Swift; name=Swift -// GLOBAL_TYPE-DAG: Decl[Struct]/OtherModule[Swift]: Int; name=Int +// GLOBAL_TYPE-DAG: Decl[Module]/None/IsSystem: Swift; name=Swift +// GLOBAL_TYPE-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int; name=Int // GLOBAL_TYPE: End completions @@ -89,7 +89,7 @@ func testPostfix(value: MyStruct) { // EXPR_POSTFIX-DAG: Decl[Subscript]/CurrNominal: [_ param: Int]; name=[param: Int] // EXPR_POSTFIX-DAG: Decl[Subscript]/CurrNominal: [label param: Int]; name=[label: Int] // EXPR_POSTFIX-DAG: Keyword[self]/CurrNominal: self; name=self -// EXPR_POSTFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: +; name=+ MyStruct +// EXPR_POSTFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: +; name=+ MyStruct // EXPR_POSTFIX: End completions func testImplicitMember() -> MyStruct { diff --git a/test/IDE/complete_at_start_1.swift b/test/IDE/complete_at_start_1.swift index c5c410b195ac4..6d3fca0754038 100644 --- a/test/IDE/complete_at_start_1.swift +++ b/test/IDE/complete_at_start_1.swift @@ -8,11 +8,11 @@ // A-DAG: Literal[Boolean]/None: true[#Bool#]{{; name=.+$}} // A-DAG: Literal[Boolean]/None: false[#Bool#]{{; name=.+$}} // A-DAG: Literal[Nil]/None: nil{{; name=.+$}} -// A-DAG: Decl[Struct]/OtherModule[Swift]: Int8[#Int8#]{{; name=.+$}} -// A-DAG: Decl[Struct]/OtherModule[Swift]: Int16[#Int16#]{{; name=.+$}} -// A-DAG: Decl[Struct]/OtherModule[Swift]: Int32[#Int32#]{{; name=.+$}} -// A-DAG: Decl[Struct]/OtherModule[Swift]: Int64[#Int64#]{{; name=.+$}} -// A-DAG: Decl[Struct]/OtherModule[Swift]: Bool[#Bool#]{{; name=.+$}} +// A-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int8[#Int8#]{{; name=.+$}} +// A-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int16[#Int16#]{{; name=.+$}} +// A-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int32[#Int32#]{{; name=.+$}} +// A-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int64[#Int64#]{{; name=.+$}} +// A-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Bool[#Bool#]{{; name=.+$}} // A: End completions // This function just adds more non-comment tokens to ensure that the file is not empty. diff --git a/test/IDE/complete_at_top_level.swift b/test/IDE/complete_at_top_level.swift index 73154457906d0..681177f0d5372 100644 --- a/test/IDE/complete_at_top_level.swift +++ b/test/IDE/complete_at_top_level.swift @@ -435,8 +435,8 @@ func resyncParserB11() {} // rdar://21346928 func optStr() -> String? { return nil } let x = (optStr() ?? "autoclosure").#^TOP_LEVEL_AUTOCLOSURE_1^# -// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: unicodeScalars[#String.UnicodeScalarView#] -// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#] +// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal/IsSystem: unicodeScalars[#String.UnicodeScalarView#] +// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal/IsSystem: utf16[#String.UTF16View#] func resyncParserB12() {} @@ -470,7 +470,7 @@ func resyncParserB14() {} var stringInterp = "\(#^STRING_INTERP_3^#)" _ = "" + "\(#^STRING_INTERP_4^#)" + "" // STRING_INTERP: Begin completions -// STRING_INTERP-DAG: Decl[InstanceMethod]/CurrNominal: ['(']{#(value): T#}[')'][#Void#]; +// STRING_INTERP-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: ['(']{#(value): T#}[')'][#Void#]; // STRING_INTERP-DAG: Decl[Struct]/CurrModule: FooStruct[#FooStruct#]; // STRING_INTERP-DAG: Decl[FreeFunction]/CurrModule/TypeRelation[Invalid]: fooFunc1()[#Void#]; // STRING_INTERP-DAG: Decl[FreeFunction]/CurrModule: optStr()[#String?#]; diff --git a/test/IDE/complete_cache.swift b/test/IDE/complete_cache.swift index 9370f41e99a6f..bea95625aad7e 100644 --- a/test/IDE/complete_cache.swift +++ b/test/IDE/complete_cache.swift @@ -57,21 +57,21 @@ import ctypes @_private(sourceFile: "AppKit.swift") import AppKit // CLANG_CTYPES: Begin completions -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/keyword[Foo1, Struct1]: FooStruct1[#FooStruct1#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/keyword[Foo2]: FooStruct2[#FooStruct2#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/recommended[Foo2, Foo1]: FooStruct3[#FooStruct3#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/recommendedover[Foo3, Foo2]: FooStruct4[#FooStruct4#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]: FooStruct5[#FooStruct5#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/recommendedover[ro1, ro2, ro3, ro4]/recommended[r1, r2, r3]/keyword[k1, k2, k3, k4]: FooStruct6[#FooStruct6#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[TypeAlias]/OtherModule[ctypes]/keyword[Foo2]: FooStructTypedef1[#FooStruct2#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/keyword[Foo1, Struct1]: FooStruct1[#FooStruct1#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/keyword[Foo2]: FooStruct2[#FooStruct2#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/recommended[Foo2, Foo1]: FooStruct3[#FooStruct3#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/recommendedover[Foo3, Foo2]: FooStruct4[#FooStruct4#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem: FooStruct5[#FooStruct5#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/recommendedover[ro1, ro2, ro3, ro4]/recommended[r1, r2, r3]/keyword[k1, k2, k3, k4]: FooStruct6[#FooStruct6#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[TypeAlias]/OtherModule[ctypes]/IsSystem/keyword[Foo2]: FooStructTypedef1[#FooStruct2#]{{; name=.+$}} // CLANG_CTYPES: End completions // CLANG_MACROS: Begin completions -// CLANG_MACROS-DAG: Decl[GlobalVar]/OtherModule[macros]: USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} +// CLANG_MACROS-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} // CLANG_MACROS: End completions // CLANG_DARWIN: Begin completions -// CLANG_DARWIN-DAG: Decl[TypeAlias]/OtherModule[Darwin.MacTypes]: FourCharCode[#UInt32#]{{; name=.+$}} +// CLANG_DARWIN-DAG: Decl[TypeAlias]/OtherModule[Darwin.MacTypes]/IsSystem: FourCharCode[#UInt32#]{{; name=.+$}} // CLANG_DARWIN_NEG-NOT: FixedPtr // CLANG_DARWIN_NEG-NOT: UniCharCoun // CLANG_DARWIN: End completions @@ -83,36 +83,36 @@ func testClangModule() { func testCompleteModuleQualifiedMacros1() { macros.#^CLANG_QUAL_MACROS_1^# // CLANG_QUAL_MACROS_1: Begin completions -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: A_PI[#Double#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: CF_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: EOF[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: GL_FALSE[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: GL_RGBA[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: GL_RGB[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: MINUS_THREE[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: M_PIf[#Float#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-objc-DAG: Decl[GlobalVar]/OtherModule[macros]: OBJC_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: UTF8_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: VERSION_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: A_PI[#Double#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: CF_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: EOF[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: GL_FALSE[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: GL_RGBA[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: GL_RGB[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: MINUS_THREE[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: M_PIf[#Float#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-objc-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: OBJC_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: UTF8_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: VERSION_STRING[#String#]{{; name=.+$}} // CLANG_QUAL_MACROS_1: End completions } func testCompleteModuleQualifiedMacros2() { macros#^CLANG_QUAL_MACROS_2^# // CLANG_QUAL_MACROS_2: Begin completions -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .A_PI[#Double#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .CF_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .EOF[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .GL_FALSE[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .GL_RGBA[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .GL_RGB[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .MINUS_THREE[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .M_PIf[#Float#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-objc-DAG: Decl[GlobalVar]/OtherModule[macros]: .OBJC_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .UTF8_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]: .VERSION_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .A_PI[#Double#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .CF_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .EOF[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .GL_FALSE[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .GL_RGBA[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .GL_RGB[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .MINUS_THREE[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .M_PIf[#Float#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-objc-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .OBJC_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .UTF8_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_2-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: .VERSION_STRING[#String#]{{; name=.+$}} // CLANG_QUAL_MACROS_2: End completions } diff --git a/test/IDE/complete_call_arg.swift b/test/IDE/complete_call_arg.swift index d545bffcf4782..ba59d28f333d1 100644 --- a/test/IDE/complete_call_arg.swift +++ b/test/IDE/complete_call_arg.swift @@ -210,7 +210,7 @@ class C1 { // EXPECT_INT-DAG: Decl[FreeFunction]/CurrModule/TypeRelation[Identical]: intGen()[#Int#]; name=intGen() // EXPECT_INT-DAG: Decl[GlobalVar]/CurrModule/TypeRelation[Identical]: i1[#Int#]; name=i1 // EXPECT_INT-DAG: Decl[GlobalVar]/CurrModule/TypeRelation[Identical]: i2[#Int#]; name=i2 -// EXPECT_INT-DAG: Decl[Struct]/OtherModule[Swift]/TypeRelation[Identical]: Int[#Int#] +// EXPECT_INT-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem/TypeRelation[Identical]: Int[#Int#] // EXPECT_INT-DAG: Decl[FreeFunction]/CurrModule: ointGen()[#Int?#]; name=ointGen() // EXPECT_INT-DAG: Decl[GlobalVar]/CurrModule: oi1[#Int?#]; name=oi1 // EXPECT_INT-DAG: Decl[GlobalVar]/CurrModule: os2[#String?#]; name=os2 @@ -249,7 +249,7 @@ class C2 { // EXPECT_STRING-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: f1()[#Void#]; name=f1() // EXPECT_STRING-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: f2()[#Void#]; name=f2() // EXPECT_STRING-DAG: Decl[FreeFunction]/CurrModule/TypeRelation[Identical]: stringGen()[#String#]; name=stringGen() -// EXPECT_STRING-DAG: Decl[Struct]/OtherModule[Swift]/TypeRelation[Identical]: String[#String#] +// EXPECT_STRING-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem/TypeRelation[Identical]: String[#String#] // EXPECT_STRING-DAG: Decl[GlobalVar]/CurrModule/TypeRelation[Identical]: s1[#String#]; name=s1 // EXPECT_STRING-DAG: Decl[GlobalVar]/CurrModule/TypeRelation[Identical]: s2[#String#]; name=s2 // EXPECT_STRING-DAG: Decl[GlobalVar]/CurrModule: os1[#String?#]; name=os1 @@ -447,10 +447,10 @@ class C4 { // MEMBER4-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: StringTaker({#(s1): String#}, {#s2: String#})[#Void#]; name=StringTaker(s1: String, s2: String) // MEMBER7: Begin completions -// MEMBER7-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: removeAll()[#Void#]; name=removeAll() -// MEMBER7-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: removeAll({#keepingCapacity: Bool#})[#Void#]; name=removeAll(keepingCapacity: Bool) -// MEMBER7-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Convertible]: count[#Int#]; name=count -// MEMBER7-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Convertible]: capacity[#Int#]; name=capacity +// MEMBER7-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: removeAll()[#Void#]; name=removeAll() +// MEMBER7-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: removeAll({#keepingCapacity: Bool#})[#Void#]; name=removeAll(keepingCapacity: Bool) +// MEMBER7-DAG: Decl[InstanceVar]/CurrNominal/IsSystem/TypeRelation[Convertible]: count[#Int#]; name=count +// MEMBER7-DAG: Decl[InstanceVar]/CurrNominal/IsSystem/TypeRelation[Convertible]: capacity[#Int#]; name=capacity // MEMBER8: Begin completions // MEMBER8-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Convertible]: InternalIntGen()[#Int#]; name=InternalIntGen() @@ -593,8 +593,8 @@ func testSubscript(obj: HasSubscript, intValue: Int, strValue: String) { // SUBSCRIPT_1_DOT: Begin completions // SUBSCRIPT_1_DOT-NOT: i1 // SUBSCRIPT_1_DOT-NOT: s1 -// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/ExprSpecific: max[#Int#]; name=max -// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/ExprSpecific: min[#Int#]; name=min +// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/ExprSpecific/IsSystem: max[#Int#]; name=max +// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/ExprSpecific/IsSystem: min[#Int#]; name=min let _ = obj[42, #^SUBSCRIPT_2^# // SUBSCRIPT_2: Begin completions, 1 items @@ -614,8 +614,8 @@ func testSubscript(obj: HasSubscript, intValue: Int, strValue: String) { // SUBSCRIPT_3_DOT: Begin completions // SUBSCRIPT_3_DOT-NOT: i1 // SUBSCRIPT_3_DOT-NOT: s1 -// SUBSCRIPT_3_DOT-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: init()[#String#]; name=init() -// SUBSCRIPT_3_DOT-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: init({#(c): Character#})[#String#]; name=init(c: Character) +// SUBSCRIPT_3_DOT-DAG: Decl[Constructor]/CurrNominal/IsSystem/TypeRelation[Identical]: init()[#String#]; name=init() +// SUBSCRIPT_3_DOT-DAG: Decl[Constructor]/CurrNominal/IsSystem/TypeRelation[Identical]: init({#(c): Character#})[#String#]; name=init(c: Character) } @@ -669,7 +669,7 @@ func testStaticMemberCall() { // STATIC_METHOD_AFTERPAREN_2: Begin completions // STATIC_METHOD_AFTERPAREN_2-DAG: Decl[StaticMethod]/CurrNominal/TypeRelation[Identical]: ['(']{#(arg1): Int#}[')'][#TestStaticMemberCall#]; // STATIC_METHOD_AFTERPAREN_2-DAG: Decl[StaticMethod]/CurrNominal/TypeRelation[Identical]: ['(']{#(arg1): Int#}, {#arg2: Int#}, {#arg3: Int#}, {#arg4: Int#}[')'][#TestStaticMemberCall#]; -// STATIC_METHOD_AFTERPAREN_2-DAG: Decl[Struct]/OtherModule[Swift]/TypeRelation[Identical]: Int[#Int#]; +// STATIC_METHOD_AFTERPAREN_2-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem/TypeRelation[Identical]: Int[#Int#]; // STATIC_METHOD_AFTERPAREN_2-DAG: Literal[Integer]/None/TypeRelation[Identical]: 0[#Int#]; // STATIC_METHOD_AFTERPAREN_2: End completions @@ -697,7 +697,7 @@ func testImplicitMember() { // IMPLICIT_MEMBER_AFTERPAREN_2: Begin completions // IMPLICIT_MEMBER_AFTERPAREN_2-DAG: Decl[StaticMethod]/CurrNominal: ['(']{#(arg1): Int#}[')'][#TestStaticMemberCall#]; // IMPLICIT_MEMBER_AFTERPAREN_2-DAG: Decl[StaticMethod]/CurrNominal: ['(']{#(arg1): Int#}, {#arg2: Int#}, {#arg3: Int#}, {#arg4: Int#}[')'][#TestStaticMemberCall#]; -// IMPLICIT_MEMBER_AFTERPAREN_2-DAG: Decl[Struct]/OtherModule[Swift]/TypeRelation[Identical]: Int[#Int#]; +// IMPLICIT_MEMBER_AFTERPAREN_2-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem/TypeRelation[Identical]: Int[#Int#]; // IMPLICIT_MEMBER_AFTERPAREN_2-DAG: Literal[Integer]/None/TypeRelation[Identical]: 0[#Int#]; // IMPLICIT_MEMBER_AFTERPAREN_2: End completions diff --git a/test/IDE/complete_crashes.swift b/test/IDE/complete_crashes.swift index 827ecdff41677..971b820219ae4 100644 --- a/test/IDE/complete_crashes.swift +++ b/test/IDE/complete_crashes.swift @@ -224,8 +224,8 @@ func foo_38149042(bar: Bar_38149042) { // RDAR_38149042: Begin completions // RDAR_38149042-DAG: Decl[InstanceVar]/CurrNominal: .x[#Int#]; name=x // RDAR_38149042-DAG: Keyword[self]/CurrNominal: .self[#Baz_38149042#]; name=self -// RDAR_38149042-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']=== {#AnyObject?#}[#Bool#]; name==== AnyObject? -// RDAR_38149042-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']!== {#AnyObject?#}[#Bool#]; name=!== AnyObject? +// RDAR_38149042-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']=== {#AnyObject?#}[#Bool#]; name==== AnyObject? +// RDAR_38149042-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']!== {#AnyObject?#}[#Bool#]; name=!== AnyObject? // RDAR_38149042: End completions // rdar://problem/38272904 @@ -291,7 +291,7 @@ public final class IntStore { } } // RDAR_41232519: Begin completions -// RDAR_41232519: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']+ {#Int#}[#Int#]; name=+ Int +// RDAR_41232519: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']+ {#Int#}[#Int#]; name=+ Int // RDAR_41232519: End completions // rdar://problem/28188259 @@ -355,8 +355,8 @@ extension Foo { } #endif // RDAR_41234606: Begin completion -// RDAR_41234606-DAG: Decl[AssociatedType]/CurrNominal: .Element; name=Element -// RDAR_41234606-DAG: Decl[AssociatedType]/CurrNominal: .Iterator; name=Iterator +// RDAR_41234606-DAG: Decl[AssociatedType]/CurrNominal/IsSystem: .Element; name=Element +// RDAR_41234606-DAG: Decl[AssociatedType]/CurrNominal/IsSystem: .Iterator; name=Iterator // RDAR_41234606: End completions // rdar://problem/41071587 diff --git a/test/IDE/complete_cross_import.swift b/test/IDE/complete_cross_import.swift index eb561cdc6ac34..e19bdea5fd4a5 100644 --- a/test/IDE/complete_cross_import.swift +++ b/test/IDE/complete_cross_import.swift @@ -19,7 +19,7 @@ func foo() { } // COMPLETE-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test -// COMPLETE-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift +// COMPLETE-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // COMPLETE-DAG: Decl[Module]/None: B[#Module#]; name=B // COMPLETE-DAG: Decl[Module]/None: A[#Module#]; name=A // COMPLETE-DAG: Decl[FreeFunction]/OtherModule[B]: fromB()[#Void#]; name=fromB() diff --git a/test/IDE/complete_cross_import_indirect.swift b/test/IDE/complete_cross_import_indirect.swift index 0708f0e934ade..a7ec764bc81c7 100644 --- a/test/IDE/complete_cross_import_indirect.swift +++ b/test/IDE/complete_cross_import_indirect.swift @@ -15,7 +15,7 @@ func foo() { } // COMPLETE-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test -// COMPLETE-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift +// COMPLETE-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // COMPLETE-DAG: Decl[Module]/None: B[#Module#]; name=B // COMPLETE-DAG: Decl[Module]/None: A[#Module#]; name=A // COMPLETE-DAG: Decl[FreeFunction]/OtherModule[C]: fromC()[#Void#]; name=fromC() diff --git a/test/IDE/complete_cross_import_multiple.swift b/test/IDE/complete_cross_import_multiple.swift index a3bee717cf4a9..0eb334434b90e 100644 --- a/test/IDE/complete_cross_import_multiple.swift +++ b/test/IDE/complete_cross_import_multiple.swift @@ -17,7 +17,7 @@ func foo() { } // COMPLETE-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test -// COMPLETE-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift +// COMPLETE-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // COMPLETE-DAG: Decl[Module]/None: B[#Module#]; name=B // COMPLETE-DAG: Decl[Module]/None: A[#Module#]; name=A // COMPLETE-DAG: Decl[Module]/None: D[#Module#]; name=D diff --git a/test/IDE/complete_cross_import_no_underscore.swift b/test/IDE/complete_cross_import_no_underscore.swift index f6fcd2d63fa13..a07f7a977a99a 100644 --- a/test/IDE/complete_cross_import_no_underscore.swift +++ b/test/IDE/complete_cross_import_no_underscore.swift @@ -16,7 +16,7 @@ func foo() { } // COMPLETE-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test -// COMPLETE-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift +// COMPLETE-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // COMPLETE-DAG: Decl[Module]/None: B[#Module#]; name=B // COMPLETE-DAG: Decl[Module]/None: D[#Module#]; name=D // COMPLETE-DAG: Decl[FreeFunction]/OtherModule[B]: fromB()[#Void#]; name=fromB() diff --git a/test/IDE/complete_cross_import_no_underscore_imported.swift b/test/IDE/complete_cross_import_no_underscore_imported.swift index 1d686da9da22b..bea1478cef790 100644 --- a/test/IDE/complete_cross_import_no_underscore_imported.swift +++ b/test/IDE/complete_cross_import_no_underscore_imported.swift @@ -16,7 +16,7 @@ func foo() { } // COMPLETE-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test -// COMPLETE-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift +// COMPLETE-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // COMPLETE-DAG: Decl[Module]/None: B[#Module#]; name=B // COMPLETE-DAG: Decl[Module]/None: D[#Module#]; name=D // COMPLETE-DAG: Decl[FreeFunction]/OtherModule[B]: fromB()[#Void#]; name=fromB() diff --git a/test/IDE/complete_dynamic_lookup.swift b/test/IDE/complete_dynamic_lookup.swift index 14c4fcb1895fe..1dba037ded74b 100644 --- a/test/IDE/complete_dynamic_lookup.swift +++ b/test/IDE/complete_dynamic_lookup.swift @@ -232,8 +232,8 @@ protocol Bar { func bar() } // TLOC_MEMBERS_NO_DOT-NEXT: Decl[InstanceMethod]/CurrNominal: .topLevelObjcClass_InstanceFunc1()[#Void#]{{; name=.+$}} // TLOC_MEMBERS_NO_DOT-NEXT: Decl[Subscript]/CurrNominal: [{#(i): Int8#}][#Int#]{{; name=.+$}} // TLOC_MEMBERS_NO_DOT-NEXT: Decl[InstanceVar]/CurrNominal: .topLevelObjcClass_Property1[#Int#]{{; name=.+$}} -// TLOC_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: === {#AnyObject?#}[#Bool#]; -// TLOC_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: !== {#AnyObject?#}[#Bool#]; +// TLOC_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: === {#AnyObject?#}[#Bool#]; +// TLOC_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: !== {#AnyObject?#}[#Bool#]; // TLOC_MEMBERS_NO_DOT-NEXT: Keyword[self]/CurrNominal: .self[#TopLevelObjcClass#]; name=self // TLOC_MEMBERS_NO_DOT-NEXT: End completions diff --git a/test/IDE/complete_enum_elements.swift b/test/IDE/complete_enum_elements.swift index 45b575f7f7a14..01a5138abee84 100644 --- a/test/IDE/complete_enum_elements.swift +++ b/test/IDE/complete_enum_elements.swift @@ -283,7 +283,7 @@ enum QuxEnum : Int { // QUX_ENUM_NO_DOT-NEXT: Decl[EnumElement]/CurrNominal: .Qux2[#QuxEnum#]{{; name=.+$}} // QUX_ENUM_NO_DOT-NEXT: Decl[TypeAlias]/CurrNominal: .RawValue[#Int#]{{; name=.+$}} // QUX_ENUM_NO_DOT-NEXT: Decl[Constructor]/CurrNominal: ({#rawValue: Int#})[#QuxEnum?#]{{; name=.+$}} -// QUX_ENUM_NO_DOT-NEXT: Decl[InstanceMethod]/Super: .hash({#(self): QuxEnum#})[#(into: inout Hasher) -> Void#]{{; name=.+$}} +// QUX_ENUM_NO_DOT-NEXT: Decl[InstanceMethod]/Super/IsSystem: .hash({#(self): QuxEnum#})[#(into: inout Hasher) -> Void#]{{; name=.+$}} // QUX_ENUM_NO_DOT-NEXT: Keyword[self]/CurrNominal: .self[#QuxEnum.Type#]; name=self // QUX_ENUM_NO_DOT-NEXT: Keyword/CurrNominal: .Type[#QuxEnum.Type#]; name=Type // QUX_ENUM_NO_DOT-NEXT: End completions @@ -295,7 +295,7 @@ enum QuxEnum : Int { // QUX_ENUM_DOT-NEXT: Decl[EnumElement]/CurrNominal: Qux2[#QuxEnum#]{{; name=.+$}} // QUX_ENUM_DOT-NEXT: Decl[TypeAlias]/CurrNominal: RawValue[#Int#]{{; name=.+$}} // QUX_ENUM_DOT-NEXT: Decl[Constructor]/CurrNominal: init({#rawValue: Int#})[#QuxEnum?#]{{; name=.+$}} -// QUX_ENUM_DOT-NEXT: Decl[InstanceMethod]/Super/TypeRelation[Invalid]: hash({#(self): QuxEnum#})[#(into: inout Hasher) -> Void#]{{; name=.+$}} +// QUX_ENUM_DOT-NEXT: Decl[InstanceMethod]/Super/IsSystem/TypeRelation[Invalid]: hash({#(self): QuxEnum#})[#(into: inout Hasher) -> Void#]{{; name=.+$}} // QUX_ENUM_DOT-NEXT: End completions func freeFunc() {} diff --git a/test/IDE/complete_exception.swift b/test/IDE/complete_exception.swift index 0a3fb079d354d..48d222ced7565 100644 --- a/test/IDE/complete_exception.swift +++ b/test/IDE/complete_exception.swift @@ -76,7 +76,7 @@ func test001() { // CATCH1-DAG: Decl[Class]/CurrModule: Error1[#Error1#]; name=Error1{{$}} // CATCH1-DAG: Keyword[let]/None: let{{; name=.+$}} // CATCH1-DAG: Decl[Class]/CurrModule: NoneError1[#NoneError1#]; name=NoneError1{{$}} -// CATCH1-DAG: Decl[Class]/OtherModule[Foundation]: NSError[#NSError#]{{; name=.+$}} +// CATCH1-DAG: Decl[Class]/OtherModule[Foundation]/IsSystem: NSError[#NSError#]{{; name=.+$}} } func test002() { @@ -210,13 +210,13 @@ func test014() { e.#^INSIDE_CATCH_ERR_DOT3^# } // NSERROR_DOT: Begin completions -// NSERROR_DOT-DAG: Decl[InstanceVar]/CurrNominal: domain[#String#]; name=domain -// NSERROR_DOT-DAG: Decl[InstanceVar]/CurrNominal: code[#Int#]; name=code -// NSERROR_DOT-DAG: Decl[InstanceVar]/Super: hashValue[#Int#]; name=hashValue -// NSERROR_DOT-DAG: Decl[InstanceMethod]/Super: myClass()[#AnyClass!#]; name=myClass() -// NSERROR_DOT-DAG: Decl[InstanceMethod]/Super: isEqual({#(other): NSObject!#})[#Bool#]; name=isEqual(other: NSObject!) -// NSERROR_DOT-DAG: Decl[InstanceVar]/Super: hash[#Int#]; name=hash -// NSERROR_DOT-DAG: Decl[InstanceVar]/Super: description[#String#]; name=description +// NSERROR_DOT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: domain[#String#]; name=domain +// NSERROR_DOT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: code[#Int#]; name=code +// NSERROR_DOT-DAG: Decl[InstanceVar]/Super: hashValue[#Int#]; name=hashValue +// NSERROR_DOT-DAG: Decl[InstanceMethod]/Super/IsSystem: myClass()[#AnyClass!#]; name=myClass() +// NSERROR_DOT-DAG: Decl[InstanceMethod]/Super/IsSystem: isEqual({#(other): NSObject!#})[#Bool#]; name=isEqual(other: NSObject!) +// NSERROR_DOT-DAG: Decl[InstanceVar]/Super/IsSystem: hash[#Int#]; name=hash +// NSERROR_DOT-DAG: Decl[InstanceVar]/Super/IsSystem: description[#String#]; name=description // NSERROR_DOT: End completions } func test015() { @@ -227,8 +227,8 @@ func test015() { } // Check that we can complete on the bound value; Not exhaustive.. // INT_DOT: Begin completions -// INT_DOT-DAG: Decl[InstanceVar]/Super: bigEndian[#(Int32)#]; name=bigEndian -// INT_DOT-DAG: Decl[InstanceVar]/Super: littleEndian[#(Int32)#]; name=littleEndian +// INT_DOT-DAG: Decl[InstanceVar]/Super/IsSystem: bigEndian[#(Int32)#]; name=bigEndian +// INT_DOT-DAG: Decl[InstanceVar]/Super/IsSystem: littleEndian[#(Int32)#]; name=littleEndian // INT_DOT: End completions //===--- Inside catch body top-level diff --git a/test/IDE/complete_expr_postfix_begin.swift b/test/IDE/complete_expr_postfix_begin.swift index 21242c75eaf59..1cc2d6879a4ec 100644 --- a/test/IDE/complete_expr_postfix_begin.swift +++ b/test/IDE/complete_expr_postfix_begin.swift @@ -140,11 +140,11 @@ typealias FooTypealias = Int // COMMON-DAG: Literal[Boolean]/None: true[#Bool#]{{; name=.+$}} // COMMON-DAG: Literal[Boolean]/None: false[#Bool#]{{; name=.+$}} // COMMON-DAG: Literal[Nil]/None: nil{{; name=.+$}} -// COMMON-DAG: Decl[Struct]/OtherModule[Swift]: Int8[#Int8#]{{; name=.+$}} -// COMMON-DAG: Decl[Struct]/OtherModule[Swift]: Int16[#Int16#]{{; name=.+$}} -// COMMON-DAG: Decl[Struct]/OtherModule[Swift]: Int32[#Int32#]{{; name=.+$}} -// COMMON-DAG: Decl[Struct]/OtherModule[Swift]: Int64[#Int64#]{{; name=.+$}} -// COMMON-DAG: Decl[Struct]/OtherModule[Swift]: Bool[#Bool#]{{; name=.+$}} +// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int8[#Int8#]{{; name=.+$}} +// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int16[#Int16#]{{; name=.+$}} +// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int32[#Int32#]{{; name=.+$}} +// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int64[#Int64#]{{; name=.+$}} +// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Bool[#Bool#]{{; name=.+$}} // COMMON-DAG: Keyword[#function]/None{{(/TypeRelation\[Identical\])?}}: #function[#String#]{{; name=.+$}} // COMMON-DAG: Keyword[#file]/None{{(/TypeRelation\[Identical\])?}}: #file[#String#]{{; name=.+$}} // COMMON-DAG: Keyword[#line]/None{{(/TypeRelation\[Identical\])?}}: #line[#Int#]{{; name=.+$}} diff --git a/test/IDE/complete_expr_tuple.swift b/test/IDE/complete_expr_tuple.swift index c5d712d649836..0f2295f8b99c2 100644 --- a/test/IDE/complete_expr_tuple.swift +++ b/test/IDE/complete_expr_tuple.swift @@ -30,12 +30,12 @@ func testTupleNoDot1() { // TUPLE_NO_DOT_1: Begin completions, 10 items // TUPLE_NO_DOT_1-DAG: Pattern/CurrNominal: .0[#Int#]{{; name=.+$}} // TUPLE_NO_DOT_1-DAG: Pattern/CurrNominal: .1[#Double#]{{; name=.+$}} -// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: <= {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: >= {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: != {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: > {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: <= {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: >= {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_1-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: > {#(Int, Double)#}[#Bool#]{{; name=.+$}} // TUPLE_NO_DOT_1-DAG: BuiltinOperator/None: = {#(Int, Double)#}[#Void#]{{; name=.+$}} // TUPLE_NO_DOT_1-NEXT: Keyword[self]/CurrNominal: .self[#(Int, Double)#]; name=self // TUPLE_NO_DOT_1-NEXT: End completions @@ -47,12 +47,12 @@ func testTupleNoDot2() { // TUPLE_NO_DOT_2: Begin completions, 10 items // TUPLE_NO_DOT_2-DAG: Pattern/CurrNominal: .foo[#Int#]{{; name=.+$}} // TUPLE_NO_DOT_2-DAG: Pattern/CurrNominal: .bar[#Double#]{{; name=.+$}} -// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: <= {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: >= {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: != {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: > {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: <= {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: >= {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_2-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: > {#(Int, Double)#}[#Bool#]{{; name=.+$}} // TUPLE_NO_DOT_2-DAG: BuiltinOperator/None: = {#(foo: Int, bar: Double)#}[#Void#]{{; name=.+$}} // TUPLE_NO_DOT_2-DAG: Keyword[self]/CurrNominal: .self[#(foo: Int, bar: Double)#]; name=self // TUPLE_NO_DOT_2-NEXT: End completions @@ -64,12 +64,12 @@ func testTupleNoDot3() { // TUPLE_NO_DOT_3: Begin completions, 10 items // TUPLE_NO_DOT_3-DAG: Pattern/CurrNominal: .foo[#Int#]{{; name=.+$}} // TUPLE_NO_DOT_3-DAG: Pattern/CurrNominal: .1[#Double#]{{; name=.+$}} -// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: <= {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: >= {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: != {#(Int, Double)#}[#Bool#]{{; name=.+$}} -// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: > {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: <= {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: >= {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#(Int, Double)#}[#Bool#]{{; name=.+$}} +// TUPLE_NO_DOT_3-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: > {#(Int, Double)#}[#Bool#]{{; name=.+$}} // TUPLE_NO_DOT_3-DAG: BuiltinOperator/None: = {#(foo: Int, Double)#}[#Void#]{{; name=.+$}} // TUPLE_NO_DOT_3-DAG: Keyword[self]/CurrNominal: .self[#(foo: Int, Double)#]; name=self // TUPLE_NO_DOT_3-NEXT: End completions diff --git a/test/IDE/complete_from_clang_framework.swift b/test/IDE/complete_from_clang_framework.swift index 14a2e82fd712b..4e8ffebcde5ff 100644 --- a/test/IDE/complete_from_clang_framework.swift +++ b/test/IDE/complete_from_clang_framework.swift @@ -341,7 +341,7 @@ func testExportedModuleCompletion() -> #^TYPE_MODULE_QUALIFIER^# { let x = #^EXPR_MODULE_QUALIFIER^# // MODULE_QUALIFIER: Begin completions // MODULE_QUALIFIER-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test -// MODULE_QUALIFIER-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift +// MODULE_QUALIFIER-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // MODULE_QUALIFIER-DAG: Decl[Module]/None: Foo[#Module#]; name=Foo // MODULE_QUALIFIER-DAG: Decl[Module]/None: FooHelper[#Module#]; name=FooHelper // MODULE_QUALIFIER-DAG: Decl[Module]/None: Bar[#Module#]; name=Bar diff --git a/test/IDE/complete_from_clang_importer_framework.swift b/test/IDE/complete_from_clang_importer_framework.swift index 93da9f2b5d1b7..7ec195825abf7 100644 --- a/test/IDE/complete_from_clang_importer_framework.swift +++ b/test/IDE/complete_from_clang_importer_framework.swift @@ -12,21 +12,21 @@ import ctypes import Darwin // CLANG_CTYPES: Begin completions -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/keyword[Foo1, Struct1]: FooStruct1[#FooStruct1#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/keyword[Foo2]: FooStruct2[#FooStruct2#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/recommended[Foo2, Foo1]: FooStruct3[#FooStruct3#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/recommendedover[Foo3, Foo2]: FooStruct4[#FooStruct4#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]: FooStruct5[#FooStruct5#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/recommendedover[ro1, ro2, ro3, ro4]/recommended[r1, r2, r3]/keyword[k1, k2, k3, k4]: FooStruct6[#FooStruct6#]{{; name=.+$}} -// CLANG_CTYPES-DAG: Decl[TypeAlias]/OtherModule[ctypes]/keyword[Foo2]: FooStructTypedef1[#FooStruct2#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/keyword[Foo1, Struct1]: FooStruct1[#FooStruct1#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/keyword[Foo2]: FooStruct2[#FooStruct2#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/recommended[Foo2, Foo1]: FooStruct3[#FooStruct3#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/recommendedover[Foo3, Foo2]: FooStruct4[#FooStruct4#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem: FooStruct5[#FooStruct5#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[Struct]/OtherModule[ctypes]/IsSystem/recommendedover[ro1, ro2, ro3, ro4]/recommended[r1, r2, r3]/keyword[k1, k2, k3, k4]: FooStruct6[#FooStruct6#]{{; name=.+$}} +// CLANG_CTYPES-DAG: Decl[TypeAlias]/OtherModule[ctypes]/IsSystem/keyword[Foo2]: FooStructTypedef1[#FooStruct2#]{{; name=.+$}} // CLANG_CTYPES: End completions // CLANG_MACROS: Begin completions -// CLANG_MACROS-DAG: Decl[GlobalVar]/OtherModule[macros]: USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} +// CLANG_MACROS-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: USES_MACRO_FROM_OTHER_MODULE_1[#Int32#]{{; name=.+$}} // CLANG_MACROS: End completions // CLANG_DARWIN: Begin completions -// CLANG_DARWIN-DAG: Decl[TypeAlias]/OtherModule[Darwin.MacTypes]: FourCharCode[#UInt32#]{{; name=.+$}} +// CLANG_DARWIN-DAG: Decl[TypeAlias]/OtherModule[Darwin.MacTypes]/IsSystem: FourCharCode[#UInt32#]{{; name=.+$}} // CLANG_DARWIN_NEG-NOT: FixedPtr // CLANG_DARWIN_NEG-NOT: UniCharCoun // CLANG_DARWIN: End completions @@ -38,21 +38,21 @@ func testClangModule() { func testCompleteModuleQualifiedMacros1() { macros.#^CLANG_QUAL_MACROS_1^# // CLANG_QUAL_MACROS_1: Begin completions, 16 items -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: A_PI[#CDouble#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: CF_STRING[#CString#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: EOF[#Int32#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: GL_FALSE[#Int32#]{{$}`} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: GL_RGBA[#CInt#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: GL_RGB[#CInt#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: INT64_MAX[#CLongLong#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: MACRO_FROM_IMPL[#CInt#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: MINUS_THREE[#CInt#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: M_PIf[#CFloat#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: OBJC_STRING[#String#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: UINT32_MAX[#CUnsignedInt#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: USES_MACRO_FROM_OTHER_MODULE_1[#CInt#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: UTF8_STRING[#CString#]{{; name=.+$}} -// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]: VERSION_STRING[#CString#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: A_PI[#CDouble#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: CF_STRING[#CString#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: EOF[#Int32#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: GL_FALSE[#Int32#]{{$}`} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: GL_RGBA[#CInt#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: GL_RGB[#CInt#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: INT64_MAX[#CLongLong#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: MACRO_FROM_IMPL[#CInt#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: MINUS_THREE[#CInt#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: M_PIf[#CFloat#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: OBJC_STRING[#String#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: UINT32_MAX[#CUnsignedInt#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: USES_MACRO_FROM_OTHER_MODULE_1[#CInt#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: UTF8_STRING[#CString#]{{; name=.+$}} +// CLANG_QUAL_MACROS_1-DAG: Decl[GlobalVar]/OtherModule[macros]/IsSystem: VERSION_STRING[#CString#]{{; name=.+$}} // CLANG_QUAL_MACROS_1: End completions } @@ -60,7 +60,7 @@ func testClangMember1() { var FS = FooStruct1() FS.#^CLANG_MEMBER1^# // CLANG_MEMBERS1: Begin completions, 3 items -// CLANG_MEMBERS1-DAG: Decl[InstanceVar]/CurrNominal/keyword[x, Struct1]/recommended[y]: x[#Int32#]{{; name=.+$}} -// CLANG_MEMBERS1-DAG: Decl[InstanceVar]/CurrNominal/keyword[y, Struct1]/recommendedover[x]: y[#Double#]{{; name=.+$}} +// CLANG_MEMBERS1-DAG: Decl[InstanceVar]/CurrNominal/IsSystem/keyword[x, Struct1]/recommended[y]: x[#Int32#]{{; name=.+$}} +// CLANG_MEMBERS1-DAG: Decl[InstanceVar]/CurrNominal/IsSystem/keyword[y, Struct1]/recommendedover[x]: y[#Double#]{{; name=.+$}} // CLANG_MEMBERS1-DAG: Keyword[self]/CurrNominal: self[#FooStruct1#]; name=self } diff --git a/test/IDE/complete_from_foundation_overlay.swift b/test/IDE/complete_from_foundation_overlay.swift index 05b59c60a045e..d5ab456ef95c4 100644 --- a/test/IDE/complete_from_foundation_overlay.swift +++ b/test/IDE/complete_from_foundation_overlay.swift @@ -17,7 +17,7 @@ import Foundation #^PLAIN_TOP_LEVEL_1^# // PLAIN_TOP_LEVEL: Begin completions -// PLAIN_TOP_LEVEL-DAG: Decl[Struct]/OtherModule[Foundation.NSURL]: URLResourceKey[#URLResourceKey#]{{; name=.+}} +// PLAIN_TOP_LEVEL-DAG: Decl[Struct]/OtherModule[Foundation.NSURL]/IsSystem: URLResourceKey[#URLResourceKey#]{{; name=.+}} // PLAIN_TOP_LEVEL: End completions func privateNominalMembers(a: String) { @@ -28,5 +28,5 @@ func privateNominalMembers(a: String) { // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 -// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}} +// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: startIndex[#String.Index#]{{; name=.+$}} // PRIVATE_NOMINAL_MEMBERS_1: End completions diff --git a/test/IDE/complete_from_stdlib.swift b/test/IDE/complete_from_stdlib.swift index 5414acdfe9238..5bbd2ed686198 100644 --- a/test/IDE/complete_from_stdlib.swift +++ b/test/IDE/complete_from_stdlib.swift @@ -72,7 +72,7 @@ #^PLAIN_TOP_LEVEL_1^# // PLAIN_TOP_LEVEL: Begin completions -// PLAIN_TOP_LEVEL-DAG: Decl[Struct]/OtherModule[Swift]: Array[#Array#]{{; name=.+$}} +// PLAIN_TOP_LEVEL-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Array[#Array#]{{; name=.+$}} // PLAIN_TOP_LEVEL: End completions func privateNominalMembers(_ a: String) { @@ -83,7 +83,7 @@ func privateNominalMembers(_ a: String) { // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 -// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}} +// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: startIndex[#String.Index#]{{; name=.+$}} // PRIVATE_NOMINAL_MEMBERS_1: End completions func protocolExtCollection1a(_ a: C) { @@ -91,7 +91,7 @@ func protocolExtCollection1a(_ a: C) { } // PRIVATE_NOMINAL_MEMBERS_2A: Begin completions -// PRIVATE_NOMINAL_MEMBERS_2A-DAG: map({#(transform): (C.Element) throws -> T##(C.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_2A-DAG/IsSystem: map({#(transform): (C.Element) throws -> T##(C.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_2A: End completions // NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2A-NOT: Decl{{.*}}: index({#before: Comparable#}) @@ -109,8 +109,8 @@ func protocolExtCollection2(_ } // PRIVATE_NOMINAL_MEMBERS_3: Begin completions -// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceMethod]/Super: map({#(transform): (C.Element) throws -> T##(C.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceVar]/Super: lazy[#LazySequence#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceMethod]/Super/IsSystem: map({#(transform): (C.Element) throws -> T##(C.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceVar]/Super/IsSystem: lazy[#LazySequence#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_3-DAG: firstIndex({#where: (C.Element) throws -> Bool##(C.Element) throws -> Bool#})[' rethrows'][#Comparable?#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_3: End completions // NEGATIVE_PRIVATE_NOMINAL_MEMBERS_3-NOT: Decl{{.*}}: firstIndex({#({{.*}}): Self.Iterator.Element @@ -119,10 +119,10 @@ func protocolExtArray(_ a: [T]) { a.#^PRIVATE_NOMINAL_MEMBERS_4^# } // PRIVATE_NOMINAL_MEMBERS_4: Begin completions -// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: map({#(transform): (Equatable) throws -> T##(Equatable) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceVar]/Super: last[#Equatable?#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: firstIndex({#of: Equatable#})[#Int?#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super: firstIndex({#where: (Equatable) throws -> Bool##(Equatable) throws -> Bool#})[' rethrows'][#Int?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super/IsSystem: map({#(transform): (Equatable) throws -> T##(Equatable) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceVar]/Super/IsSystem: last[#Equatable?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super/IsSystem: firstIndex({#of: Equatable#})[#Int?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_4-DAG: Decl[InstanceMethod]/Super/IsSystem: firstIndex({#where: (Equatable) throws -> Bool##(Equatable) throws -> Bool#})[' rethrows'][#Int?#]{{; name=.+}} // PRIVATE_NOMINAL_MEMBERS_4: End completions func testArchetypeReplacement1(_ a: [FOO]) { @@ -130,14 +130,14 @@ func testArchetypeReplacement1(_ a: [FOO]) { } // PRIVATE_NOMINAL_MEMBERS_5: Begin completions -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/CurrNominal: append({#(newElement): Equatable#})[#Void#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/CurrNominal: insert({#(newElement): Equatable#}, {#at: Int#})[#Void#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceVar]/Super: isEmpty[#Bool#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceVar]/Super: first[#Equatable?#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super: dropFirst({#(k): Int#})[#ArraySlice#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super: dropLast({#(k): Int#})[#ArraySlice#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super: prefix({#(maxLength): Int#})[#ArraySlice#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super: suffix({#(maxLength): Int#})[#ArraySlice#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: append({#(newElement): Equatable#})[#Void#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: insert({#(newElement): Equatable#}, {#at: Int#})[#Void#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceVar]/Super/IsSystem: isEmpty[#Bool#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceVar]/Super/IsSystem: first[#Equatable?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super/IsSystem: dropFirst({#(k): Int#})[#ArraySlice#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super/IsSystem: dropLast({#(k): Int#})[#ArraySlice#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super/IsSystem: prefix({#(maxLength): Int#})[#ArraySlice#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_5-DAG: Decl[InstanceMethod]/Super/IsSystem: suffix({#(maxLength): Int#})[#ArraySlice#]{{; name=.+}} func testArchetypeReplacement2(_ a: [BAR]) { @@ -145,16 +145,16 @@ func testArchetypeReplacement2(_ a: [BAR]) { } // PRIVATE_NOMINAL_MEMBERS_6: Begin completions -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/CurrNominal: append({#(newElement): Equatable#})[#Void#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/CurrNominal: insert({#(newElement): Equatable#}, {#at: Int#})[#Void#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: dropFirst()[#ArraySlice#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: dropLast()[#[Equatable]#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: enumerated()[#EnumeratedSequence<[Equatable]>#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: min({#by: (Equatable, Equatable) throws -> Bool##(Equatable, Equatable) throws -> Bool#})[' rethrows'][#Equatable?#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: max({#by: (Equatable, Equatable) throws -> Bool##(Equatable, Equatable) throws -> Bool#})[' rethrows'][#Equatable?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: append({#(newElement): Equatable#})[#Void#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: insert({#(newElement): Equatable#}, {#at: Int#})[#Void#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: dropFirst()[#ArraySlice#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: dropLast()[#[Equatable]#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: enumerated()[#EnumeratedSequence<[Equatable]>#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: min({#by: (Equatable, Equatable) throws -> Bool##(Equatable, Equatable) throws -> Bool#})[' rethrows'][#Equatable?#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: max({#by: (Equatable, Equatable) throws -> Bool##(Equatable, Equatable) throws -> Bool#})[' rethrows'][#Equatable?#]{{; name=.+}} // FIXME: The following should include 'partialResult' as local parameter name: "(nextPartialResult): (_ partialResult: Result, Equatable)" -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: reduce({#(initialResult): Result#}, {#(nextPartialResult): (Result, Equatable) throws -> Result##(Result, Equatable) throws -> Result#})[' rethrows'][#Result#]{{; name=.+}} -// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super: dropFirst({#(k): Int#})[#ArraySlice#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: reduce({#(initialResult): Result#}, {#(nextPartialResult): (Result, Equatable) throws -> Result##(Result, Equatable) throws -> Result#})[' rethrows'][#Result#]{{; name=.+}} +// PRIVATE_NOMINAL_MEMBERS_6-DAG: Decl[InstanceMethod]/Super/IsSystem: dropFirst({#(k): Int#})[#ArraySlice#]{{; name=.+}} // FIXME: restore Decl[InstanceMethod]/Super: flatMap({#(transform): (Equatable) throws -> Sequence##(Equatable) throws -> Sequence#})[' rethrows'][#[IteratorProtocol.Element]#]{{; name=.+}} func testArchetypeReplacement3 (_ a : [Int]) { @@ -162,13 +162,13 @@ func testArchetypeReplacement3 (_ a : [Int]) { } // PRIVATE_NOMINAL_MEMBERS_7: Begin completions -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/CurrNominal: append({#(newElement): Int#})[#Void#] -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super: removeLast()[#Int#] -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceVar]/Super: first[#Int?#] -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super: map({#(transform): (Int) throws -> T##(Int) throws -> T#})[' rethrows'][#[T]#] -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super: dropLast({#(k): Int#})[#ArraySlice#] -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super: elementsEqual({#(other): Sequence#}, {#by: (Int, Sequence.Element) throws -> Bool##(Int, Sequence.Element) throws -> Bool#})[' rethrows'][#Bool#]; name=elementsEqual(other: Sequence, by: (Int, Sequence.Element) throws -> Bool) rethrows -// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super: elementsEqual({#(other): Sequence#})[#Bool#]; name=elementsEqual(other: Sequence) +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: append({#(newElement): Int#})[#Void#] +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super/IsSystem: removeLast()[#Int#] +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceVar]/Super/IsSystem: first[#Int?#] +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super/IsSystem: map({#(transform): (Int) throws -> T##(Int) throws -> T#})[' rethrows'][#[T]#] +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super/IsSystem: dropLast({#(k): Int#})[#ArraySlice#] +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super/IsSystem: elementsEqual({#(other): Sequence#}, {#by: (Int, Sequence.Element) throws -> Bool##(Int, Sequence.Element) throws -> Bool#})[' rethrows'][#Bool#]; name=elementsEqual(other: Sequence, by: (Int, Sequence.Element) throws -> Bool) rethrows +// PRIVATE_NOMINAL_MEMBERS_7-DAG: Decl[InstanceMethod]/Super/IsSystem: elementsEqual({#(other): Sequence#})[#Bool#]; name=elementsEqual(other: Sequence) protocol P2 { @@ -225,8 +225,8 @@ func testPostfixOperator1(_ x: Int) { func testPostfixOperator2(_ x: inout Int) { x#^POSTFIX_INT_2^# } -// POSTFIX_LVALUE_INT-NOT: Decl[PostfixOperatorFunction]/OtherModule[Swift]: ++[#Int#]; name= -// POSTFIX_LVALUE_INT-NOT: Decl[PostfixOperatorFunction]/OtherModule[Swift]: --[#Int#]; name= +// POSTFIX_LVALUE_INT-NOT: Decl[PostfixOperatorFunction]/OtherModule[Swift]/IsSystem: ++[#Int#]; name= +// POSTFIX_LVALUE_INT-NOT: Decl[PostfixOperatorFunction]/OtherModule[Swift]/IsSystem: --[#Int#]; name= func testPostfixOperator3(_ x: MyInt??) { x#^POSTFIX_OPTIONAL_1^# @@ -237,12 +237,12 @@ func testInfixOperator1(_ x: Int) { x#^INFIX_INT_1^# } // INFIX_INT: Begin completions -// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: ... {#Int#}[#ClosedRange#] -// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: &+ {#Int#}[#Int#] -// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#Int#}[#Int#] -// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: &<< {#Int#}[#Int#] -// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#Int#}[#Bool#] -// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#Int#}[#Bool#] +// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: ... {#Int#}[#ClosedRange#] +// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: &+ {#Int#}[#Int#] +// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#Int#}[#Int#] +// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: &<< {#Int#}[#Int#] +// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#Int#}[#Bool#] +// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#Int#}[#Bool#] // INFIX_INT: End completions // NEGATIVE_INFIX_INT-NOT: && // NEGATIVE_INFIX_INT-NOT: += @@ -250,13 +250,13 @@ func testInfixOperator2(_ x: inout Int) { x#^INFIX_INT_2^# } // INFIX_LVALUE_INT: Begin completions -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: ... {#Int#}[#ClosedRange#] -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: &+ {#Int#}[#Int#] -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#Int#}[#Int#] -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: &<< {#Int#}[#Int#] -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#Int#}[#Bool#] -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#Int#}[#Bool#] -// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: += {#Int#}[#Void#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: ... {#Int#}[#ClosedRange#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: &+ {#Int#}[#Int#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#Int#}[#Int#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: &<< {#Int#}[#Int#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#Int#}[#Bool#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#Int#}[#Bool#] +// INFIX_LVALUE_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: += {#Int#}[#Void#] // INFIX_LVALUE_INT-NOT: && // INFIX_LVALUE_INT: End completions @@ -264,9 +264,9 @@ func testInfixOperator3(_ x: String) { x#^INFIX_STRING_1^# } // INFIX_STRING: Begin completions -// INFIX_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#String#}[#String#] -// INFIX_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#String#}[#Bool#] -// INFIX_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#String#}[#Bool#] +// INFIX_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#String#}[#String#] +// INFIX_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#String#}[#Bool#] +// INFIX_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#String#}[#Bool#] // INFIX_STRING-NOT: += // INFIX_STRING-NOT: << // INFIX_STRING: End completions @@ -275,19 +275,19 @@ func testInfixOperator4(_ x: String) { x == ""#^INFIX_EXT_STRING_1^# } // INFIX_EXT_STRING: Begin completions -// INFIX_EXT_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#String#}[#String#] -// INFIX_EXT_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: || {#Bool#}[#Bool#] -// INFIX_EXT_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: && {#Bool#}[#Bool#] +// INFIX_EXT_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#String#}[#String#] +// INFIX_EXT_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: || {#Bool#}[#Bool#] +// INFIX_EXT_STRING-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: && {#Bool#}[#Bool#] // INFIX_EXT_STRING-NOT: == // INFIX_EXT_STRING: End completions class TestSequence : Sequence { #^CONFORM_SEQUENCE^# // CONFORM_SEQUENCE: Begin completions -// CONFORM_SEQUENCE-DAG: Decl[AssociatedType]/Super: typealias Element = {#(Type)#}; -// CONFORM_SEQUENCE-DAG: Decl[AssociatedType]/Super: typealias Iterator = {#(Type)#}; -// CONFORM_SEQUENCE-DAG: Decl[InstanceMethod]/Super: func makeIterator() -> some IteratorProtocol {|}; -// CONFORM_SEQUENCE-DAG: Decl[InstanceVar]/Super: var underestimatedCount: Int; -// CONFORM_SEQUENCE-DAG: Decl[InstanceMethod]/Super: func withContiguousStorageIfAvailable(_ body: (UnsafeBufferPointer) throws -> R) rethrows -> R? {|}; +// CONFORM_SEQUENCE-DAG: Decl[AssociatedType]/Super/IsSystem: typealias Element = {#(Type)#}; +// CONFORM_SEQUENCE-DAG: Decl[AssociatedType]/Super/IsSystem: typealias Iterator = {#(Type)#}; +// CONFORM_SEQUENCE-DAG: Decl[InstanceMethod]/Super/IsSystem: func makeIterator() -> some IteratorProtocol {|}; +// CONFORM_SEQUENCE-DAG: Decl[InstanceVar]/Super/IsSystem: var underestimatedCount: Int; +// CONFORM_SEQUENCE-DAG: Decl[InstanceMethod]/Super/IsSystem: func withContiguousStorageIfAvailable(_ body: (UnsafeBufferPointer) throws -> R) rethrows -> R? {|}; // CONFORM_SEQUENCE: End completions } diff --git a/test/IDE/complete_from_swift_module.swift b/test/IDE/complete_from_swift_module.swift index 0f95c0560b344..3f193f19844ca 100644 --- a/test/IDE/complete_from_swift_module.swift +++ b/test/IDE/complete_from_swift_module.swift @@ -63,7 +63,7 @@ func testQualifyingModulesSuggested() -> #^QUALIFYING_MODULE^# { let x = #^QUALIFYING_MODULE_2^# // QUALIFYING_MODULE: Begin completions // QUALIFYING_MODULE-DAG: Decl[Module]/None: swift_ide_test[#Module#]; name=swift_ide_test - // QUALIFYING_MODULE-DAG: Decl[Module]/None: Swift[#Module#]; name=Swift + // QUALIFYING_MODULE-DAG: Decl[Module]/None/IsSystem: Swift[#Module#]; name=Swift // QUALIFYING_MODULE-DAG: Decl[Module]/None: foo_swift_module[#Module#]; name=foo_swift_module // QUALIFYING_MODULE: End completions } @@ -141,15 +141,15 @@ func testPostfixOperator1(x: Int) { struct Foo: Swift.Array.#^STDLIB_TYPE_QUALIFIED_NESTED^# {} // STDLIB_TYPE_QUALIFIED_NESTED: Begin completions -// STDLIB_TYPE_QUALIFIED_NESTED: Decl[TypeAlias]/CurrNominal: Index[#Int#]; name=Index -// STDLIB_TYPE_QUALIFIED_NESTED: Decl[TypeAlias]/CurrNominal: Element[#Element#]; name=Element +// STDLIB_TYPE_QUALIFIED_NESTED: Decl[TypeAlias]/CurrNominal/IsSystem: Index[#Int#]; name=Index +// STDLIB_TYPE_QUALIFIED_NESTED: Decl[TypeAlias]/CurrNominal/IsSystem: Element[#Element#]; name=Element // STDLIB_TYPE_QUALIFIED_NESTED: Keyword/None: Type[#Array.Type#]; name=Type // STDLIB_TYPE_QUALIFIED_NESTED: End completions struct Bar: Swift.#^STDLIB_TYPE_QUALIFIED^# {} // STDLIB_TYPE_QUALIFIED: Begin completions // STDLIB_TYPE_QUALIFIED-NOT: Decl[Module] -// STDLIB_TYPE_QUALIFIED: Decl[Struct]/OtherModule[Swift]: AnyCollection[#AnyCollection#]; name=AnyCollection +// STDLIB_TYPE_QUALIFIED: Decl[Struct]/OtherModule[Swift]/IsSystem: AnyCollection[#AnyCollection#]; name=AnyCollection // STDLIB_TYPE_QUALIFIED-NOT: Decl[Module] // STDLIB_TYPE_QUALIFIED: End completions diff --git a/test/IDE/complete_from_swiftonly_systemmodule.swift b/test/IDE/complete_from_swiftonly_systemmodule.swift index c6e0bac2bc7e1..94d81f0fb840d 100644 --- a/test/IDE/complete_from_swiftonly_systemmodule.swift +++ b/test/IDE/complete_from_swiftonly_systemmodule.swift @@ -51,9 +51,9 @@ func test(value: SomeValue) { // GLOBAL-NOT: internalFunc // GLOBAL-NOT: _SecretClass // GLOBAL-NOT: InternalClass -// GLOBAL-DAG: Decl[Struct]/OtherModule[SomeModule]: SomeValue[#SomeValue#]; -// GLOBAL-DAG: Decl[FreeFunction]/OtherModule[SomeModule]: publicFunc()[#Void#]; -// GLOBAL-DAG: Decl[Class]/OtherModule[SomeModule]: PublicClass[#PublicClass#]; name=PublicClass +// GLOBAL-DAG: Decl[Struct]/OtherModule[SomeModule]/IsSystem: SomeValue[#SomeValue#]; +// GLOBAL-DAG: Decl[FreeFunction]/OtherModule[SomeModule]/IsSystem: publicFunc()[#Void#]; +// GLOBAL-DAG: Decl[Class]/OtherModule[SomeModule]/IsSystem: PublicClass[#PublicClass#]; name=PublicClass // GLOBAL: End completions let _: #^GLOBAL_TYPE^# @@ -67,12 +67,12 @@ func test(value: SomeValue) { let _ = value.#^INSTANCE^# // INSTANCE: Begin completions, 3 items // INSTANCE-DAG: Keyword[self]/CurrNominal: self[#SomeValue#]; -// INSTANCE-DAG: Decl[InstanceVar]/CurrNominal: publicValue[#Int#]; -// INSTANCE-DAG: Decl[InstanceMethod]/CurrNominal: publicMethod()[#Int#]; +// INSTANCE-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: publicValue[#Int#]; +// INSTANCE-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: publicMethod()[#Int#]; // INSTANCE: End completions let _ = SomeValue(#^INITIALIZER^# // INITIALIZER: Begin completions, 1 items -// INITIALIZER-DAG: Decl[Constructor]/CurrNominal: ['(']{#public: Int#}[')'][#SomeValue#]; +// INITIALIZER-DAG: Decl[Constructor]/CurrNominal/IsSystem: ['(']{#public: Int#}[')'][#SomeValue#]; // INITIALIZER: End completions } diff --git a/test/IDE/complete_in_closures.swift b/test/IDE/complete_in_closures.swift index 4b2c68a308a00..f93713055ba0a 100644 --- a/test/IDE/complete_in_closures.swift +++ b/test/IDE/complete_in_closures.swift @@ -397,11 +397,11 @@ var foo = { let x = "Siesta:\(3)".#^DECL_IN_CLOSURE_IN_TOPLEVEL_INIT^# // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT: Begin completions // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Keyword[self]/CurrNominal: self[#String#]; name=self - // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal: count[#Int#]; name=count - // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal: unicodeScalars[#String.UnicodeScalarView#]; name=unicodeScalars - // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceMethod]/CurrNominal: hasPrefix({#(prefix): String#})[#Bool#]; name=hasPrefix(prefix: String) - // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#]; name=utf16 - // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceMethod]/Super: dropFirst()[#Substring#]; name=dropFirst() + // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]; name=count + // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: unicodeScalars[#String.UnicodeScalarView#]; name=unicodeScalars + // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: hasPrefix({#(prefix): String#})[#Bool#]; name=hasPrefix(prefix: String) + // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: utf16[#String.UTF16View#]; name=utf16 + // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT-DAG: Decl[InstanceMethod]/Super/IsSystem: dropFirst()[#Substring#]; name=dropFirst() // DECL_IN_CLOSURE_IN_TOPLEVEL_INIT: End completions } @@ -409,8 +409,8 @@ func testWithMemoryRebound(_ bar: UnsafePointer) { _ = bar.withMemoryRebound(to: Int64.self, capacity: 3) { ptr in return ptr #^SINGLE_EXPR_CLOSURE_CONTEXT^# // SINGLE_EXPR_CLOSURE_CONTEXT: Begin completions - // SINGLE_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceMethod]/CurrNominal: .deallocate()[#Void#]; name=deallocate() - // SINGLE_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal: .pointee[#Int64#]; name=pointee + // SINGLE_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: .deallocate()[#Void#]; name=deallocate() + // SINGLE_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .pointee[#Int64#]; name=pointee // SINGLE_EXPR_CLOSURE_CONTEXT: End completions } } @@ -419,14 +419,14 @@ func testInsideTernaryClosureReturn(test: Bool) -> [String] { return "hello".map { thing in test ? String(thing #^SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT^#).uppercased() : String(thing).lowercased() // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT: Begin completions - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal: .utf8[#Character.UTF8View#]; name=utf8 - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal: .description[#String#]; name=description - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal: .isWhitespace[#Bool#]; name=isWhitespace - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceMethod]/CurrNominal: .uppercased()[#String#]; name=uppercased() - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']... {#String.Element#}[#ClosedRange#]; name=... String.Element - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']< {#Character#}[#Bool#]; name=< Character - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']>= {#String.Element#}[#Bool#]; name=>= String.Element - // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']== {#Character#}[#Bool#]; name=== Character + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .utf8[#Character.UTF8View#]; name=utf8 + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .description[#String#]; name=description + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .isWhitespace[#Bool#]; name=isWhitespace + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: .uppercased()[#String#]; name=uppercased() + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']... {#String.Element#}[#ClosedRange#]; name=... String.Element + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']< {#Character#}[#Bool#]; name=< Character + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']>= {#String.Element#}[#Bool#]; name=>= String.Element + // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']== {#Character#}[#Bool#]; name=== Character // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT-DAG: Keyword[self]/CurrNominal: .self[#String.Element#]; name=self // SINGLE_TERNARY_EXPR_CLOSURE_CONTEXT: End completions } diff --git a/test/IDE/complete_literal.swift b/test/IDE/complete_literal.swift index 253f3a058a303..836885cee0f92 100644 --- a/test/IDE/complete_literal.swift +++ b/test/IDE/complete_literal.swift @@ -13,55 +13,55 @@ 1.#^LITERAL1^# } // LITERAL1: Begin completions -// LITERAL1-DAG: Decl[InstanceVar]/Super: bigEndian[#Int#]; name=bigEndian{{$}} -// LITERAL1-DAG: Decl[InstanceVar]/Super: littleEndian[#Int#]; name=littleEndian{{$}} -// LITERAL1-DAG: Decl[InstanceVar]/CurrNominal: byteSwapped[#Int#]; name=byteSwapped{{$}} -// LITERAL1-DAG: Decl[InstanceVar]/CurrNominal: nonzeroBitCount[#Int#]; name=nonzeroBitCount{{$}} +// LITERAL1-DAG: Decl[InstanceVar]/Super/IsSystem: bigEndian[#Int#]; name=bigEndian{{$}} +// LITERAL1-DAG: Decl[InstanceVar]/Super/IsSystem: littleEndian[#Int#]; name=littleEndian{{$}} +// LITERAL1-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: byteSwapped[#Int#]; name=byteSwapped{{$}} +// LITERAL1-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: nonzeroBitCount[#Int#]; name=nonzeroBitCount{{$}} { 1.1.#^LITERAL2^# } // LITERAL2: Begin completions -// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal: isNormal[#Bool#]; name=isNormal{{$}} -// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal: isFinite[#Bool#]; name=isFinite{{$}} -// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal: isZero[#Bool#]; name=isZero{{$}} -// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal: isSubnormal[#Bool#]; name=isSubnormal{{$}} -// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal: isInfinite[#Bool#]; name=isInfinite{{$}} -// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal: isNaN[#Bool#]; name=isNaN{{$}} +// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: isNormal[#Bool#]; name=isNormal{{$}} +// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: isFinite[#Bool#]; name=isFinite{{$}} +// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: isZero[#Bool#]; name=isZero{{$}} +// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: isSubnormal[#Bool#]; name=isSubnormal{{$}} +// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: isInfinite[#Bool#]; name=isInfinite{{$}} +// LITERAL2-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: isNaN[#Bool#]; name=isNaN{{$}} { true.#^LITERAL3^# } // LITERAL3: Begin completions -// LITERAL3-DAG: Decl[InstanceVar]/CurrNominal: description[#String#]; name=description{{$}} -// LITERAL3-DAG: Decl[InstanceVar]/CurrNominal: hashValue[#Int#]; name=hashValue{{$}} +// LITERAL3-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: description[#String#]; name=description{{$}} +// LITERAL3-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: hashValue[#Int#]; name=hashValue{{$}} { "swift".#^LITERAL4^# } // LITERAL4: Begin completions -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: withCString({#(body): (UnsafePointer) throws -> Result##(UnsafePointer) throws -> Result#})[' rethrows'][#Result#]; name=withCString(body: (UnsafePointer) throws -> Result) rethrows{{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: withCString({#(body): (UnsafePointer) throws -> Result##(UnsafePointer) throws -> Result#})[' rethrows'][#Result#]; name=withCString(body: (UnsafePointer) throws -> Result) rethrows{{$}} // FIXME: we should show the qualified String.Index type. // rdar://problem/20788802 -// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]; name=startIndex{{$}} -// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]; name=endIndex{{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: append({#(c): Character#})[#Void#]; name=append(c: Character){{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: append({#contentsOf: Sequence#})[#Void#]; name=append(contentsOf: Sequence){{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: insert({#contentsOf: Collection#}, {#at: String.Index#})[#Void#]; name=insert(contentsOf: Collection, at: String.Index){{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: remove({#at: String.Index#})[#Character#]; name=remove(at: String.Index){{$}} -// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal: lowercased()[#String#]; name=lowercased(){{$}} +// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: startIndex[#String.Index#]; name=startIndex{{$}} +// LITERAL4-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: endIndex[#String.Index#]; name=endIndex{{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: append({#(c): Character#})[#Void#]; name=append(c: Character){{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: append({#contentsOf: Sequence#})[#Void#]; name=append(contentsOf: Sequence){{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: insert({#contentsOf: Collection#}, {#at: String.Index#})[#Void#]; name=insert(contentsOf: Collection, at: String.Index){{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: remove({#at: String.Index#})[#Character#]; name=remove(at: String.Index){{$}} +// LITERAL4-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem: lowercased()[#String#]; name=lowercased(){{$}} func giveMeAString() -> Int { // rdar://22637799 return "Here's a string".#^LITERAL5^# // try .characters.count here } -// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]{{; name=.+$}} -// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: reserveCapacity({#(n): Int#})[#Void#]{{; name=.+$}} -// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: append({#(c): Character#})[#Void#]{{; name=.+$}} -// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: append({#contentsOf: Sequence#})[#Void#]{{; name=.+$}} +// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: endIndex[#String.Index#]{{; name=.+$}} +// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: reserveCapacity({#(n): Int#})[#Void#]{{; name=.+$}} +// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: append({#(c): Character#})[#Void#]{{; name=.+$}} +// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/IsSystem/TypeRelation[Invalid]: append({#contentsOf: Sequence#})[#Void#]{{; name=.+$}} struct MyColor: _ExpressibleByColorLiteral { init(_colorLiteralRed: Float, green: Float, blue: Float, alpha: Float) { red = colorLiteralRed } @@ -82,17 +82,17 @@ func testColor12() { func testArray(f1: Float) { _ = [1, 2, f1] #^LITERAL8^# } -// LITERAL8-DAG: Decl[InstanceVar]/CurrNominal: .count[#Int#]; name=count -// LITERAL8-DAG: Decl[InstanceVar]/Super: .first[#Float?#]; name=first +// LITERAL8-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .count[#Int#]; name=count +// LITERAL8-DAG: Decl[InstanceVar]/Super/IsSystem: .first[#Float?#]; name=first func testDict(f1: Float) { _ = ["foo": f1, "bar": "baz"] #^LITERAL9^# } -// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal: .keys[#Dictionary.Keys#]; name=keys -// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal: .isEmpty[#Bool#]; name=isEmpty +// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .keys[#Dictionary.Keys#]; name=keys +// LITERAL9-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .isEmpty[#Bool#]; name=isEmpty func testEditorPlaceHolder() { _ = <#T##foo##String#> #^LITERAL10^# } -// LITERAL10-DAG: Decl[InstanceVar]/CurrNominal: .utf16[#String.UTF16View#]; name=utf16 -// LITERAL10-DAG: Decl[InstanceVar]/CurrNominal: .utf8[#String.UTF8View#]; name=utf8 +// LITERAL10-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .utf16[#String.UTF16View#]; name=utf16 +// LITERAL10-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .utf8[#String.UTF8View#]; name=utf8 diff --git a/test/IDE/complete_multifile.swift b/test/IDE/complete_multifile.swift index 8dd332f36d5ec..76ad114431658 100644 --- a/test/IDE/complete_multifile.swift +++ b/test/IDE/complete_multifile.swift @@ -82,7 +82,7 @@ func testRawRepresentable() { // MYENUM_DOT-DAG: Decl[Constructor]/CurrNominal: init({#rawValue: String#})[#MyEnum?#]; // MYENUM_DOT-DAG: Decl[TypeAlias]/CurrNominal: AllCases[#[MyEnum]#]; // MYENUM_DOT-DAG: Decl[StaticVar]/CurrNominal: allCases[#[MyEnum]#]; -// MYENUM_DOT-DAG: Decl[InstanceMethod]/Super: hash({#(self): MyEnum#})[#(into: inout Hasher) -> Void#]; +// MYENUM_DOT-DAG: Decl[InstanceMethod]/Super/IsSystem: hash({#(self): MyEnum#})[#(into: inout Hasher) -> Void#]; // MYENUM_DOT: End completions } func testRawRepesentableInstance(value: MyEnum) { @@ -90,8 +90,8 @@ func testRawRepesentableInstance(value: MyEnum) { // MYENUM_INSTANCE_DOT: Begin completions, 4 items // MYENUM_INSTANCE_DOT-DAG: Keyword[self]/CurrNominal: self[#MyEnum#]; // MYENUM_INSTANCE_DOT-DAG: Decl[InstanceVar]/CurrNominal: rawValue[#String#]; -// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceVar]/Super: hashValue[#Int#]; -// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceMethod]/Super: hash({#into: &Hasher#})[#Void#]; +// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceVar]/Super/IsSystem: hashValue[#Int#]; +// MYENUM_INSTANCE_DOT-DAG: Decl[InstanceMethod]/Super/IsSystem: hash({#into: &Hasher#})[#Void#]; // MYENUM_INSTANCE_DOT: End completions } func testHasWrappedValue(value: HasWrapped) { diff --git a/test/IDE/complete_multiple_trailingclosure.swift b/test/IDE/complete_multiple_trailingclosure.swift index 5fa03207a0169..f75dab6080939 100644 --- a/test/IDE/complete_multiple_trailingclosure.swift +++ b/test/IDE/complete_multiple_trailingclosure.swift @@ -51,7 +51,7 @@ func testMethod(value: MyStruct) { // METHOD_SAMELINE: Begin completions, 4 items // METHOD_SAMELINE-DAG: Pattern/ExprSpecific: {#fn2: (() -> String)? {() -> String in|}#}[#(() -> String)?#]; // METHOD_SAMELINE-DAG: Decl[InstanceMethod]/CurrNominal: .enumFunc()[#Void#]; -// METHOD_SAMELINE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']+ {#SimpleEnum#}[#SimpleEnum#]; +// METHOD_SAMELINE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']+ {#SimpleEnum#}[#SimpleEnum#]; // METHOD_SAMELINE-DAG: Keyword[self]/CurrNominal: .self[#SimpleEnum#]; // METHOD_SAMELINE: End completions diff --git a/test/IDE/complete_operators.swift b/test/IDE/complete_operators.swift index a2be1ac431fcd..51c250c0a6b1f 100644 --- a/test/IDE/complete_operators.swift +++ b/test/IDE/complete_operators.swift @@ -168,7 +168,7 @@ func testInfix1(x: S2) { } // S2_INFIX: Begin completions // FIXME: rdar://problem/22997089 - should be CurrModule -// S2_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#S2#}[#S2#] +// S2_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#S2#}[#S2#] // S2_INFIX-DAG: Decl[InfixOperatorFunction]/CurrModule: ** {#Int#}[#S2#]; name=** // S2_INFIX: End completions // NEGATIVE_S2_INFIX-NOT: **= @@ -184,7 +184,7 @@ func testInfix2(x: inout S2) { } // S2_INFIX_LVALUE: Begin completions // FIXME: rdar://problem/22997089 - should be CurrModule -// S2_INFIX_LVALUE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#S2#}[#S2#] +// S2_INFIX_LVALUE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#S2#}[#S2#] // S2_INFIX_LVALUE-DAG: Decl[InfixOperatorFunction]/CurrModule: ** {#Int#}[#S2#] // S2_INFIX_LVALUE-DAG: Decl[InfixOperatorFunction]/CurrModule: **= {#Int#}[#Void#] // S2_INFIX_LVALUE-DAG: BuiltinOperator/None: = {#S2#}[#Void#] @@ -215,9 +215,9 @@ func testInfix7(x: S2?) { x#^INFIX_7^# } // S2_INFIX_OPTIONAL: Begin completions -// S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: != {#{{.*}}#}[#Bool#] -// S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#{{.*}}#}[#Bool#] -// S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: ?? {#S2#}[#S2#]; name=?? S2 +// S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#{{.*}}#}[#Bool#] +// S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#{{.*}}#}[#Bool#] +// S2_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: ?? {#S2#}[#S2#]; name=?? S2 // S2_INFIX_OPTIONAL: End completions // The equality operators don't come from equatable. // NEGATIVE_S2_INFIX_OPTIONAL-NOT: == {#S2 @@ -231,7 +231,7 @@ func testInfix8(x: S3?) { } // The equality operators come from equatable. // S3_INFIX_OPTIONAL: Begin completions -// S3_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#S3?#}[#Bool#] +// S3_INFIX_OPTIONAL-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#S3?#}[#Bool#] // S3_INFIX_OPTIONAL: End completions infix operator **** { @@ -301,12 +301,12 @@ func testInfix17(x: Void) { } // VOID_OPERATORS: Begin completions -// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: != {#()#}[#Bool#]; name=!= () -// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#()#}[#Bool#]; name=== () -// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: <= {#()#}[#Bool#]; name=<= () -// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: >= {#()#}[#Bool#]; name=>= () -// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#()#}[#Bool#]; name=< () -// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: > {#()#}[#Bool#]; name=> () +// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: != {#()#}[#Bool#]; name=!= () +// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: == {#()#}[#Bool#]; name=== () +// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: <= {#()#}[#Bool#]; name=<= () +// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: >= {#()#}[#Bool#]; name=>= () +// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: < {#()#}[#Bool#]; name=< () +// VOID_OPERATORS-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: > {#()#}[#Bool#]; name=> () // VOID_OPERATORS: End completions func testInfix18(x: (S2, S2) { @@ -318,8 +318,8 @@ func testInfix19(x: EmptyClass) { } // EMPTYCLASS_INFIX: Begin completions -// EMPTYCLASS_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: === {#AnyObject?#}[#Bool#] -// EMPTYCLASS_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: !== {#AnyObject?#}[#Bool#] +// EMPTYCLASS_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: === {#AnyObject?#}[#Bool#] +// EMPTYCLASS_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: !== {#AnyObject?#}[#Bool#] // EMPTYCLASS_INFIX: End completions enum E { @@ -344,7 +344,7 @@ func testSpace(x: S2) { } // S2_INFIX_SPACE: Begin completions // S2_INFIX_SPACE-DAG: Decl[InfixOperatorFunction]/CurrModule: [' ']** {#Int#}[#S2#] -// S2_INFIX_SPACE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: [' ']+ {#S2#}[#S2#] +// S2_INFIX_SPACE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: [' ']+ {#S2#}[#S2#] // S2_INFIX_SPACE: End completions func testExtInfix1(x: inout S2) { @@ -372,9 +372,9 @@ func testExtInfix2(x: S4) { x + x == x + x#^EXT_INFIX_2^# } // S4_EXT_INFIX: Begin completions -// S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#S4#}[#S4#] -// S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: && {#Bool#}[#Bool#] -// S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: || {#Bool#}[#Bool#] +// S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#S4#}[#S4#] +// S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: && {#Bool#}[#Bool#] +// S4_EXT_INFIX-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: || {#Bool#}[#Bool#] // S4_EXT_INFIX: End completions // S4_EXT_INFIX-NEG-NOT: != @@ -386,7 +386,7 @@ func testExtInfix3(x: S4) { x + x#^EXT_INFIX_3^# } // S4_EXT_INFIX_SIMPLE: Begin completions -// S4_EXT_INFIX_SIMPLE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: + {#S4#}[#S4#] +// S4_EXT_INFIX_SIMPLE-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: + {#S4#}[#S4#] // S4_EXT_INFIX_SIMPLE-DAG: Decl[InfixOperatorFunction]/CurrModule: +++ {#S4#}[#S4#] // S4_EXT_INFIX_SIMPLE: End completions diff --git a/test/IDE/complete_override.swift b/test/IDE/complete_override.swift index 239e1f5512016..4213dfa1df6ee 100644 --- a/test/IDE/complete_override.swift +++ b/test/IDE/complete_override.swift @@ -872,8 +872,8 @@ struct SynthesizedConformance1: Codable { let foo: Int #^OVERRIDE_SYNTHESIZED_1^# // OVERRIDE_SYNTHESIZED_1: Begin completions, 2 items -// OVERRIDE_SYNTHESIZED_1-DAG: Decl[Constructor]/Super: init(from decoder: Decoder) throws {|}; -// OVERRIDE_SYNTHESIZED_1-DAG: Decl[InstanceMethod]/Super: func encode(to encoder: Encoder) throws {|}; +// OVERRIDE_SYNTHESIZED_1-DAG: Decl[Constructor]/Super/IsSystem: init(from decoder: Decoder) throws {|}; +// OVERRIDE_SYNTHESIZED_1-DAG: Decl[InstanceMethod]/Super/IsSystem: func encode(to encoder: Encoder) throws {|}; } open class SynthesizedConformance2: Codable { @@ -881,7 +881,7 @@ open class SynthesizedConformance2: Codable { func encode(to encoder: Encoder) throws {} #^OVERRIDE_SYNTHESIZED_2^# // OVERRIDE_SYNTHESIZED_2: Begin completions, 1 items -// OVERRIDE_SYNTHESIZED_2: Decl[Constructor]/Super: public required init(from decoder: Decoder) throws {|}; +// OVERRIDE_SYNTHESIZED_2: Decl[Constructor]/Super/IsSystem: public required init(from decoder: Decoder) throws {|}; } struct SynthesizedConformance3: Hashable { @@ -889,23 +889,23 @@ struct SynthesizedConformance3: Hashable { #^OVERRIDE_SYNTHESIZED_3^# // FIXME: Where did Equatable.(==) go? // OVERRIDE_SYNTHESIZED_3: Begin completions, 2 items -// OVERRIDE_SYNTHESIZED_3-DAG: Decl[InstanceVar]/Super: var hashValue: Int; name=hashValue: Int -// OVERRIDE_SYNTHESIZED_3-DAG: Decl[InstanceMethod]/Super: func hash(into hasher: inout Hasher) {|} +// OVERRIDE_SYNTHESIZED_3-DAG: Decl[InstanceVar]/Super/IsSystem: var hashValue: Int; name=hashValue: Int +// OVERRIDE_SYNTHESIZED_3-DAG: Decl[InstanceMethod]/Super/IsSystem: func hash(into hasher: inout Hasher) {|} } enum SynthesizedConformance4: CaseIterable { case a, b, c, d #^OVERRIDE_SYNTHESIZED_4^# // OVERRIDE_SYNTHESIZED_4: Begin completions, 4 items -// OVERRIDE_SYNTHESIZED_4-DAG: Decl[InstanceVar]/Super: var hashValue: Int -// OVERRIDE_SYNTHESIZED_4-DAG: Decl[InstanceMethod]/Super: func hash(into hasher: inout Hasher) {|}; -// OVERRIDE_SYNTHESIZED_4-DAG: Decl[StaticVar]/Super: static var allCases: [SynthesizedConformance4]; -// OVERRIDE_SYNTHESIZED_4-DAG: Decl[AssociatedType]/Super: typealias AllCases = {#(Type)#}; +// OVERRIDE_SYNTHESIZED_4-DAG: Decl[InstanceVar]/Super/IsSystem: var hashValue: Int +// OVERRIDE_SYNTHESIZED_4-DAG: Decl[InstanceMethod]/Super/IsSystem: func hash(into hasher: inout Hasher) {|}; +// OVERRIDE_SYNTHESIZED_4-DAG: Decl[StaticVar]/Super/IsSystem: static var allCases: [SynthesizedConformance4]; +// OVERRIDE_SYNTHESIZED_4-DAG: Decl[AssociatedType]/Super/IsSystem: typealias AllCases = {#(Type)#}; } class SynthesizedConformance5: SynthesizedConformance2 { #^OVERRIDE_SYNTHESIZED_5^# // OVERRIDE_SYNTHESIZED_5: Begin completions, 2 items -// OVERRIDE_SYNTHESIZED_5-DAG: Decl[InstanceMethod]/Super: override func encode(to encoder: Encoder) throws {|}; -// OVERRIDE_SYNTHESIZED_5-DAG: Decl[Constructor]/Super: required init(from decoder: Decoder) throws {|}; +// OVERRIDE_SYNTHESIZED_5-DAG: Decl[InstanceMethod]/Super/IsSystem: override func encode(to encoder: Encoder) throws {|}; +// OVERRIDE_SYNTHESIZED_5-DAG: Decl[Constructor]/Super/IsSystem: required init(from decoder: Decoder) throws {|}; } diff --git a/test/IDE/complete_pound_selector.swift b/test/IDE/complete_pound_selector.swift index 43c6d518bb149..eccbac49c20fc 100644 --- a/test/IDE/complete_pound_selector.swift +++ b/test/IDE/complete_pound_selector.swift @@ -80,14 +80,14 @@ class Subclass : NSObject { // CHECK-SELECTOR_BASIC: Keyword/None: setter: {#@objc property#}; name=setter: @objc property // CHECK-IN_SELECTOR-NOT: getter: -// CHECK-IN_SELECTOR: Decl[Constructor]/CurrNominal: {{.?}}init; name=init -// CHECK-IN_SELECTOR: Decl[StaticMethod]/CurrNominal: {{.?}}perform(_:with:); name=perform(_:with:) -// CHECK-IN_SELECTOR: Decl[InstanceMethod]/CurrNominal: {{.?}}perform(_:with:); name=perform(_:with:) -// CHECK-IN_SELECTOR: Decl[InstanceMethod]/CurrNominal: {{.?}}myClass; name=myClass -// CHECK-IN_SELECTOR: Decl[StaticMethod]/CurrNominal: {{.?}}description; name=description -// CHECK-IN_SELECTOR: Decl[StaticMethod]/CurrNominal: {{.?}}isEqual(_:); name=isEqual(_:) -// CHECK-IN_SELECTOR: Decl[InstanceMethod]/CurrNominal: {{.?}}isEqual(_:); name=isEqual(_:) - -// CHECK-IN_SUPER_SELECTOR: Decl[InstanceMethod]/CurrNominal: {{.?}}perform(_:with:); name=perform(_:with:) -// CHECK-IN_SUPER_SELECTOR: Decl[InstanceMethod]/CurrNominal: {{.?}}myClass; name=myClass -// CHECK-IN_SUPER_SELECTOR: Decl[InstanceMethod]/CurrNominal: {{.?}}isEqual(_:); name=isEqual(_:) +// CHECK-IN_SELECTOR: Decl[Constructor]/CurrNominal/IsSystem: {{.?}}init; name=init +// CHECK-IN_SELECTOR: Decl[StaticMethod]/CurrNominal/IsSystem: {{.?}}perform(_:with:); name=perform(_:with:) +// CHECK-IN_SELECTOR: Decl[InstanceMethod]/CurrNominal/IsSystem: {{.?}}perform(_:with:); name=perform(_:with:) +// CHECK-IN_SELECTOR: Decl[InstanceMethod]/CurrNominal/IsSystem: {{.?}}myClass; name=myClass +// CHECK-IN_SELECTOR: Decl[StaticMethod]/CurrNominal/IsSystem: {{.?}}description; name=description +// CHECK-IN_SELECTOR: Decl[StaticMethod]/CurrNominal/IsSystem: {{.?}}isEqual(_:); name=isEqual(_:) +// CHECK-IN_SELECTOR: Decl[InstanceMethod]/CurrNominal/IsSystem: {{.?}}isEqual(_:); name=isEqual(_:) + +// CHECK-IN_SUPER_SELECTOR: Decl[InstanceMethod]/CurrNominal/IsSystem: {{.?}}perform(_:with:); name=perform(_:with:) +// CHECK-IN_SUPER_SELECTOR: Decl[InstanceMethod]/CurrNominal/IsSystem: {{.?}}myClass; name=myClass +// CHECK-IN_SUPER_SELECTOR: Decl[InstanceMethod]/CurrNominal/IsSystem: {{.?}}isEqual(_:); name=isEqual(_:) diff --git a/test/IDE/complete_precedencegroup.swift b/test/IDE/complete_precedencegroup.swift index 948112b818ae5..9657e21add5eb 100644 --- a/test/IDE/complete_precedencegroup.swift +++ b/test/IDE/complete_precedencegroup.swift @@ -98,8 +98,8 @@ infix operator ---: #^PRECEDENCE_GROUP_CURRFILE^# // ASSIGNMENT: Keyword[true]/None: true; name=true // PRECEDENCE_GROUP: Begin completions -// PRECEDENCE_GROUP-DAG: Decl[PrecedenceGroup]/OtherModule[Swift]: AssignmentPrecedence; name=AssignmentPrecedence -// PRECEDENCE_GROUP-DAG: Decl[PrecedenceGroup]/OtherModule[Swift]: ComparisonPrecedence; name=ComparisonPrecedence +// PRECEDENCE_GROUP-DAG: Decl[PrecedenceGroup]/OtherModule[Swift]/IsSystem: AssignmentPrecedence; name=AssignmentPrecedence +// PRECEDENCE_GROUP-DAG: Decl[PrecedenceGroup]/OtherModule[Swift]/IsSystem: ComparisonPrecedence; name=ComparisonPrecedence /* FIXME: SR-8898 We only see precedence groups that are earlier in life! */ // PRECEDENCE_GROUP_CURRFILE-DAG: Begin completions diff --git a/test/IDE/complete_stdlib_optional_objc.swift b/test/IDE/complete_stdlib_optional_objc.swift index ee2825f0df122..f76a21df4c023 100644 --- a/test/IDE/complete_stdlib_optional_objc.swift +++ b/test/IDE/complete_stdlib_optional_objc.swift @@ -63,18 +63,18 @@ func testAnyObject8(a: AnyObject) { } // UN_OPT_NO_DOT_INT: Begin completions -// UN_OPT_NO_DOT_INT-DAG: Decl[InstanceVar]/CurrNominal: ?.nonzeroBitCount[#Int#]{{; name=.+$}} +// UN_OPT_NO_DOT_INT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: ?.nonzeroBitCount[#Int#]{{; name=.+$}} // UN_OPT_NO_DOT_INT: End completions // UN_OPT_DOT_INT: Begin completions -// UN_OPT_DOT_INT-DAG: Decl[InstanceVar]/CurrNominal/Erase[1]: ?.nonzeroBitCount[#Int#]{{; name=.+$}} +// UN_OPT_DOT_INT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem/Erase[1]: ?.nonzeroBitCount[#Int#]{{; name=.+$}} // UN_OPT_DOT_INT: End completions // OBJCCLASS_MEMBERS_NO_DOT: Begin completions // OBJCCLASS_MEMBERS_NO_DOT-NEXT: Decl[InstanceVar]/CurrNominal: .instanceVar[#Int#] // OBJCCLASS_MEMBERS_NO_DOT-NEXT: Decl[InstanceMethod]/CurrNominal: .instanceFunc()[#ObjcClass#] -// OBJCCLASS_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: === {#AnyObject?#}[#Bool#] -// OBJCCLASS_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: !== {#AnyObject?#}[#Bool#] +// OBJCCLASS_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: === {#AnyObject?#}[#Bool#] +// OBJCCLASS_MEMBERS_NO_DOT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]/IsSystem: !== {#AnyObject?#}[#Bool#] // OBJCCLASS_MEMBERS_NO_DOT-NEXT: Keyword[self]/CurrNominal: .self[#ObjcClass#]; name=self // OBJCCLASS_MEMBERS_NO_DOT-NEXT: End completions diff --git a/test/IDE/complete_swift_key_path.swift b/test/IDE/complete_swift_key_path.swift index ae296f1e48e18..4935b1007a464 100644 --- a/test/IDE/complete_swift_key_path.swift +++ b/test/IDE/complete_swift_key_path.swift @@ -62,16 +62,16 @@ let _ = \Person.#^TYPE_DOT^# let _ = \Person.friends#^ARRAY_NODOT^# // ARRAY-NODOT: Begin completions -// ARRAY-NODOT-DAG: Decl[Subscript]/CurrNominal: [{#(index): Int#}][#Person#]; name=[index: Int] -// ARRAY-NODOT-DAG: Decl[InstanceVar]/CurrNominal: .count[#Int#]; name=count -// ARRAY-NODOT-DAG: Decl[InstanceVar]/Super: .first[#Person?#]; name=first +// ARRAY-NODOT-DAG: Decl[Subscript]/CurrNominal/IsSystem: [{#(index): Int#}][#Person#]; name=[index: Int] +// ARRAY-NODOT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .count[#Int#]; name=count +// ARRAY-NODOT-DAG: Decl[InstanceVar]/Super/IsSystem: .first[#Person?#]; name=first let _ = \Person.friends.#^ARRAY_DOT^# // ARRAY-DOT: Begin completions -// ARRAY-DOT-NOT: Decl[Subscript]/CurrNominal: [{#(index): Int#}][#Element#]; name=[Int] -// ARRAY-DOT-DAG: Decl[InstanceVar]/CurrNominal: count[#Int#]; name=count -// ARRAY-DOT-DAG: Decl[InstanceVar]/Super: first[#Person?#]; name=first -// ARRAY-DOT-NOT: Decl[Subscript]/CurrNominal: [{#(index): Int#}][#Element#]; name=[Int] +// ARRAY-DOT-NOT: Decl[Subscript]/CurrNominal/IsSystem: [{#(index): Int#}][#Element#]; name=[Int] +// ARRAY-DOT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]; name=count +// ARRAY-DOT-DAG: Decl[InstanceVar]/Super/IsSystem: first[#Person?#]; name=first +// ARRAY-DOT-NOT: Decl[Subscript]/CurrNominal/IsSystem: [{#(index): Int#}][#Element#]; name=[Int] let _ = \Person.friends[0]#^OBJ_NODOT^# // OBJ-NODOT: Begin completions, 5 items @@ -95,7 +95,7 @@ let _ = \Person.bestFriend#^OPTIONAL_NODOT^# // OPTIONAL-NODOT-NEXT: Decl[InstanceVar]/CurrNominal: ?.bestFriend[#Person?#]; name=bestFriend // OPTIONAL-NODOT-NEXT: Decl[InstanceVar]/CurrNominal: ?.itself[#Person#]; name=itself // OPTIONAL-NODOT-NEXT: Decl[Subscript]/CurrNominal: ?[{#(index): Int#}][#Int#]; name=[index: Int] -// OPTIONAL-NODOT: Decl[InstanceVar]/CurrNominal: .unsafelyUnwrapped[#Person#]; name=unsafelyUnwrapped +// OPTIONAL-NODOT: Decl[InstanceVar]/CurrNominal/IsSystem: .unsafelyUnwrapped[#Person#]; name=unsafelyUnwrapped let _ = \Person.bestFriend.#^OPTIONAL_DOT^# // OPTIONAL-DOT: Begin completions @@ -103,7 +103,7 @@ let _ = \Person.bestFriend.#^OPTIONAL_DOT^# // OPTIONAL-DOT-NEXT: Decl[InstanceVar]/CurrNominal/Erase[1]: ?.friends[#[Person]#]; name=friends // OPTIONAL-DOT-NEXT: Decl[InstanceVar]/CurrNominal/Erase[1]: ?.bestFriend[#Person?#]; name=bestFriend // OPTIONAL-DOT-NEXT: Decl[InstanceVar]/CurrNominal/Erase[1]: ?.itself[#Person#]; name=itself -// OPTIONAL-DOT: Decl[InstanceVar]/CurrNominal: unsafelyUnwrapped[#Person#]; name=unsafelyUnwrapped +// OPTIONAL-DOT: Decl[InstanceVar]/CurrNominal/IsSystem: unsafelyUnwrapped[#Person#]; name=unsafelyUnwrapped let _ = \Person.bestFriend?#^UNWRAPPED_NODOT^# // Same as OBJ_NODOT. @@ -119,15 +119,15 @@ let _ = \Person.bestFriend?.itself.#^CHAIN_DOT^# let _ = \[Person]#^ARRAYTYPE_NODOT^# // ARRAYTYPE-NODOT: Begin completions -// ARRAYTYPE-NODOT-DAG: Decl[Subscript]/CurrNominal: .[{#(index): Int#}][#Person#]; name=[index: Int] -// ARRAYTYPE-NODOT-DAG: Decl[InstanceVar]/CurrNominal: .count[#Int#]; name=count -// ARRAYTYPE-NODOT-DAG: Decl[InstanceVar]/Super: .first[#Person?#]; name=first +// ARRAYTYPE-NODOT-DAG: Decl[Subscript]/CurrNominal/IsSystem: .[{#(index): Int#}][#Person#]; name=[index: Int] +// ARRAYTYPE-NODOT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: .count[#Int#]; name=count +// ARRAYTYPE-NODOT-DAG: Decl[InstanceVar]/Super/IsSystem: .first[#Person?#]; name=first let _ = \[Person].#^ARRAYTYPE_DOT^# // ARRAYTYPE-DOT: Begin completions -// ARRAYTYPE-DOT-DAG: Decl[Subscript]/CurrNominal: [{#(index): Int#}][#Person#]; name=[index: Int] -// ARRAYTYPE-DOT-DAG: Decl[InstanceVar]/CurrNominal: count[#Int#]; name=count -// ARRAYTYPE-DOT-DAG: Decl[InstanceVar]/Super: first[#Person?#]; name=first +// ARRAYTYPE-DOT-DAG: Decl[Subscript]/CurrNominal/IsSystem: [{#(index): Int#}][#Person#]; name=[index: Int] +// ARRAYTYPE-DOT-DAG: Decl[InstanceVar]/CurrNominal/IsSystem: count[#Int#]; name=count +// ARRAYTYPE-DOT-DAG: Decl[InstanceVar]/Super/IsSystem: first[#Person?#]; name=first func test(_ p: Person) { let _ = p[keyPath: \Person.#^APPLY_TYPE_DOT^#] diff --git a/test/IDE/complete_type_subscript.swift b/test/IDE/complete_type_subscript.swift index 5411068a60b6c..b35946d0669ba 100644 --- a/test/IDE/complete_type_subscript.swift +++ b/test/IDE/complete_type_subscript.swift @@ -11,7 +11,7 @@ struct S0 { } // TOP_LEVEL_0: Keyword/None: Any[#Any#]; // TOP_LEVEL_0: Decl[Struct]/CurrModule: S0[#S0#]; -// TOP_LEVEL_0: Decl[Struct]/OtherModule[Swift]: Int[#Int#]; +// TOP_LEVEL_0: Decl[Struct]/OtherModule[Swift]/IsSystem: Int[#Int#]; // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PARAM_1 | %FileCheck %s -check-prefix=MYSTRUCT_0 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RETURN_1 | %FileCheck %s -check-prefix=MYSTRUCT_0 @@ -42,7 +42,7 @@ struct G0 { // GEN_TOP_LEVEL_0: Keyword/None: Any[#Any#]; // GEN_TOP_LEVEL_0: Decl[GenericTypeParam]/Local: T[#T#]; name=T // GEN_TOP_LEVEL_0: Decl[Struct]/CurrModule: S0[#S0#]; -// GEN_TOP_LEVEL_0: Decl[Struct]/OtherModule[Swift]: Int[#Int#]; +// GEN_TOP_LEVEL_0: Decl[Struct]/OtherModule[Swift]/IsSystem: Int[#Int#]; // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GEN_PARAM_1 | %FileCheck %s -check-prefix=GEN_PARAM_1 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GEN_RETURN_1 | %FileCheck %s -check-prefix=GEN_PARAM_1 @@ -69,7 +69,7 @@ struct G3 { // GEN_TOP_LEVEL_1: Keyword/None: Any[#Any#]; // GEN_TOP_LEVEL_1: Decl[GenericTypeParam]/Local: T[#T#]; // GEN_TOP_LEVEL_1: Decl[Struct]/CurrModule: S0[#S0#]; -// GEN_TOP_LEVEL_1: Decl[Struct]/OtherModule[Swift]: Int[#Int#]; +// GEN_TOP_LEVEL_1: Decl[Struct]/OtherModule[Swift]/IsSystem: Int[#Int#]; // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GEN_PARAM_4 | %FileCheck %s -check-prefix=GEN_PARAM_4 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GEN_RETURN_4 | %FileCheck %s -check-prefix=GEN_PARAM_4 diff --git a/test/IDE/complete_unresolved_members.swift b/test/IDE/complete_unresolved_members.swift index 8ed1a35153ec6..de767c0ae9336 100644 --- a/test/IDE/complete_unresolved_members.swift +++ b/test/IDE/complete_unresolved_members.swift @@ -289,8 +289,8 @@ class C4 { // UNRESOLVED_3_OPT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: North[#SomeEnum1#]; // UNRESOLVED_3_OPT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: South[#SomeEnum1#]; // UNRESOLVED_3_OPT-DAG: Keyword[nil]/None/Erase[1]: nil[#SomeEnum1?#]; name=nil -// UNRESOLVED_3_OPT-DAG: Decl[EnumElement]/CurrNominal: none[#Optional#]; name=none -// UNRESOLVED_3_OPT-DAG: Decl[EnumElement]/CurrNominal: some({#SomeEnum1#})[#Optional#]; +// UNRESOLVED_3_OPT-DAG: Decl[EnumElement]/CurrNominal/IsSystem: none[#Optional#]; name=none +// UNRESOLVED_3_OPT-DAG: Decl[EnumElement]/CurrNominal/IsSystem: some({#SomeEnum1#})[#Optional#]; // UNRESOLVED_3_OPT-NOT: init({#(some): // UNRESOLVED_3_OPT-NOT: init({#nilLiteral: @@ -298,8 +298,8 @@ class C4 { // UNRESOLVED_3_OPTOPTOPT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: North[#SomeEnum1#]; // UNRESOLVED_3_OPTOPTOPT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: South[#SomeEnum1#]; // UNRESOLVED_3_OPTOPTOPT-DAG: Keyword[nil]/None/Erase[1]: nil[#SomeEnum1???#]; name=nil -// UNRESOLVED_3_OPTOPTOPT-DAG: Decl[EnumElement]/CurrNominal: none[#Optional#]; name=none -// UNRESOLVED_3_OPTOPTOPT-DAG: Decl[EnumElement]/CurrNominal: some({#SomeEnum1??#})[#Optional#]; +// UNRESOLVED_3_OPTOPTOPT-DAG: Decl[EnumElement]/CurrNominal/IsSystem: none[#Optional#]; name=none +// UNRESOLVED_3_OPTOPTOPT-DAG: Decl[EnumElement]/CurrNominal/IsSystem: some({#SomeEnum1??#})[#Optional#]; // UNRESOLVED_3_OPTOPTOPT-NOT: init({#(some): // UNRESOLVED_3_OPTOPTOPT-NOT: init({#nilLiteral: @@ -316,9 +316,9 @@ func testOptionalWithCustomExtension() { // UNRESOLVED_OPT_4-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: earth[#Somewhere#]; // UNRESOLVED_OPT_4-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: mars[#Somewhere#]; // UNRESOLVED_OPT_4-DAG: Keyword[nil]/None/Erase[1]: nil[#Somewhere?#]; name=nil -// UNRESOLVED_OPT_4-DAG: Decl[EnumElement]/CurrNominal: none[#Optional#]; name=none -// UNRESOLVED_OPT_4-DAG: Decl[EnumElement]/CurrNominal: some({#Somewhere#})[#Optional#]; -// UNRESOLVED_OPT_4-DAG: Decl[Constructor]/CurrNominal: init({#str: String#})[#Optional#]; name=init(str: String) +// UNRESOLVED_OPT_4-DAG: Decl[EnumElement]/CurrNominal/IsSystem: none[#Optional#]; name=none +// UNRESOLVED_OPT_4-DAG: Decl[EnumElement]/CurrNominal/IsSystem: some({#Somewhere#})[#Optional#]; +// UNRESOLVED_OPT_4-DAG: Decl[Constructor]/CurrNominal: init({#str: String#})[#Optional#]; name=init(str: String) // UNRESOLVED_OPT_4-DAG: Decl[StaticVar]/CurrNominal/TypeRelation[Identical]: nowhere[#Optional#]; name=nowhere // UNRESOLVED_OPT_4-NOT: init({#(some): // UNRESOLVED_OPT_4-NOT: init({#nilLiteral: @@ -780,6 +780,6 @@ func testTernaryOperator2(cond: Bool) { func sync(){} let _: SomeEnum1 = .#^TERNARY_CONDITION^# ? .bogus : .bogus // TERNARY_CONDITION: Begin completions -// TERNARY_CONDITION-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: init()[#Bool#]; name=init() +// TERNARY_CONDITION-DAG: Decl[Constructor]/CurrNominal/IsSystem/TypeRelation[Identical]: init()[#Bool#]; name=init() // TERNARY_CONDITION: End completions } diff --git a/test/IDE/complete_value_expr.swift b/test/IDE/complete_value_expr.swift index 3e3f9bfe5bb8a..eabd01144a73a 100644 --- a/test/IDE/complete_value_expr.swift +++ b/test/IDE/complete_value_expr.swift @@ -1418,12 +1418,12 @@ func testTypeCheckNil() { func testResolveModules1() { Swift#^RESOLVE_MODULES_1^# // RESOLVE_MODULES_1: Begin completions -// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]: .Int8[#Int8#]{{; name=.+$}} -// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]: .Int16[#Int16#]{{; name=.+$}} -// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]: .Int32[#Int32#]{{; name=.+$}} -// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]: .Int64[#Int64#]{{; name=.+$}} -// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]: .Bool[#Bool#]{{; name=.+$}} -// RESOLVE_MODULES_1-DAG: Decl[TypeAlias]/OtherModule[Swift]: .Float32[#Float#]{{; name=.+$}} +// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: .Int8[#Int8#]{{; name=.+$}} +// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: .Int16[#Int16#]{{; name=.+$}} +// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: .Int32[#Int32#]{{; name=.+$}} +// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: .Int64[#Int64#]{{; name=.+$}} +// RESOLVE_MODULES_1-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: .Bool[#Bool#]{{; name=.+$}} +// RESOLVE_MODULES_1-DAG: Decl[TypeAlias]/OtherModule[Swift]/IsSystem: .Float32[#Float#]{{; name=.+$}} // RESOLVE_MODULES_1: End completions } @@ -2045,7 +2045,7 @@ class TestDotExprWithNonNominal { // DOT_EXPR_NON_NOMINAL_2-NOT: otherField // DOT_EXPR_NON_NOMINAL_2-NOT: firstName // DOT_EXPR_NON_NOMINAL_2: Keyword[self]/CurrNominal: self[#Int#]; name=self -// DOT_EXPR_NON_NOMINAL_2: Decl[InstanceVar]/CurrNominal: hashValue[#Int#]; +// DOT_EXPR_NON_NOMINAL_2: Decl[InstanceVar]/CurrNominal/IsSystem: hashValue[#Int#]; // DOT_EXPR_NON_NOMINAL_2-NOT: otherField // DOT_EXPR_NON_NOMINAL_2-NOT: firstName } diff --git a/test/IDE/complete_where_clause.swift b/test/IDE/complete_where_clause.swift index 1d86e89f7fd9f..f7301e6e80f78 100644 --- a/test/IDE/complete_where_clause.swift +++ b/test/IDE/complete_where_clause.swift @@ -141,7 +141,7 @@ enum E2 where T.#^ENUM_2^# {} // ANYTYPE: Begin completions // ANYTYPE-DAG: Decl[GenericTypeParam]/Local: T[#T#]; // ANYTYPE-DAG: Decl[Class]/CurrModule: A1[#A1#]; -// ANYTYPE-DAG: Decl[Struct]/OtherModule[Swift]: Int[#Int#]; +// ANYTYPE-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int[#Int#]; // ANYTYPE: End completions protocol P2 { diff --git a/test/SILOptimizer/dead_code_elimination.sil b/test/SILOptimizer/dead_code_elimination.sil index 07db0a890b3cf..3e93dbc4e2986 100644 --- a/test/SILOptimizer/dead_code_elimination.sil +++ b/test/SILOptimizer/dead_code_elimination.sil @@ -259,3 +259,21 @@ bb2: bb3: br bb1 } + +// Check that DCE eliminates dead access instructions. +// CHECK-LABEL: sil @dead_access +// CHECK: bb0 +// CHECK-NEXT: tuple +// CHECK-NEXT: return +// CHECK-LABEL: end sil function 'dead_access' +sil @dead_access : $@convention(thin) (@in Container) -> () { +bb0(%0 : $*Container): + %1 = begin_access [modify] [dynamic] %0 : $*Container + end_access %1 : $*Container + + %3 = begin_access [read] [static] %0 : $*Container + end_access %3 : $*Container + + %999 = tuple () + return %999 : $() +} diff --git a/test/SILOptimizer/peephole_thick_to_objc_metatype.sil b/test/SILOptimizer/peephole_thick_to_objc_metatype.sil index 136c56cc095b8..6c0182dbd3b0a 100644 --- a/test/SILOptimizer/peephole_thick_to_objc_metatype.sil +++ b/test/SILOptimizer/peephole_thick_to_objc_metatype.sil @@ -8,6 +8,8 @@ import Builtin import Swift import SwiftShims +import Foundation + @objc(XX) protocol X { } @@ -115,3 +117,48 @@ bb0(%0 : $T): strong_release %0 : $T return %3 : $@thick T.Type } + +// CHECK-LABEL: sil @$test_peephole_objc_to_thick_to_objc : +// CHECK: [[T:%.*]] = apply +// CHECK-NOT: objc_to_thick_metatype +// CHECK-NOT: thick_to_objc_metatype +// CHECK: enum $Optional<@objc_metatype AnyObject.Type>, #Optional.some!enumelt, [[T]] : $@objc_metatype AnyObject.Type +// CHECK: } // end sil function '$test_peephole_objc_to_thick_to_objc' + +sil @$test_peephole_objc_to_thick_to_objc : $@convention(thin) (@guaranteed NSObject) -> Optional> { +// %0 "obj" // users: %3, %2, %1 +bb0(%0 : $NSObject): + debug_value %0 : $NSObject, let, name "obj", argno 1 // id: %1 + %2 = objc_method %0 : $NSObject, #NSObject.classForCoder!getter.foreign : (NSObject) -> () -> AnyObject.Type, $@convention(objc_method) (NSObject) -> @objc_metatype AnyObject.Type // user: %3 + %3 = apply %2(%0) : $@convention(objc_method) (NSObject) -> @objc_metatype AnyObject.Type // user: %4 + %4 = objc_to_thick_metatype %3 : $@objc_metatype AnyObject.Type to $@thick AnyObject.Type // users: %6, %5 + debug_value %4 : $@thick AnyObject.Type, let, name "c" // id: %5 + %6 = thick_to_objc_metatype %4 : $@thick AnyObject.Type to $@objc_metatype AnyObject.Type // user: %7 + %7 = enum $Optional<@objc_metatype AnyObject.Type>, #Optional.some!enumelt, %6 : $@objc_metatype AnyObject.Type // user: %10 + %8 = enum $Optional>, #Optional.none!enumelt // user: %10 + // function_ref class_copyMethodList + %9 = function_ref @class_copyMethodList : $@convention(c) (Optional<@objc_metatype AnyObject.Type>, Optional>) -> Optional> // user: %10 + %10 = apply %9(%7, %8) : $@convention(c) (Optional<@objc_metatype AnyObject.Type>, Optional>) -> Optional> // users: %12, %11 + debug_value %10 : $Optional>, let, name "l" // id: %11 + return %10 : $Optional> // id: %12 +} + +// CHECK-LABEL: sil @$test_peephole_thick_to_objc_to_thick : +// CHECK: [[T:%.*]] = apply +// CHECK-NOT: thick_to_objc_metatype +// CHECK-NOT: objc_to_thick_metatype +// CHECK: return [[T]] +// CHECK: } // end sil function '$test_peephole_thick_to_objc_to_thick' + +sil @$test_peephole_thick_to_objc_to_thick : $@convention(thin) (@guaranteed AnyObject) -> @thick AnyObject.Type { +bb0(%0 : $AnyObject): + %func = function_ref @foo : $@convention(thin) (@guaranteed AnyObject) -> @thick AnyObject.Type + %res = apply %func(%0) : $@convention(thin) (@guaranteed AnyObject) -> @thick AnyObject.Type + %objctype = thick_to_objc_metatype %res : $@thick AnyObject.Type to $@objc_metatype AnyObject.Type + %thicktype = objc_to_thick_metatype %objctype : $@objc_metatype AnyObject.Type to $@thick AnyObject.Type + return %thicktype : $@thick AnyObject.Type +} + +// class_copyMethodList +sil [serializable] [clang class_copyMethodList] @class_copyMethodList : $@convention(c) (Optional<@objc_metatype AnyObject.Type>, Optional>) -> Optional> +sil [serializable] @foo : $@convention(thin) (@guaranteed AnyObject) -> @thick AnyObject.Type diff --git a/test/SILOptimizer/zeroInitializer.swift b/test/SILOptimizer/zeroInitializer.swift new file mode 100644 index 0000000000000..83b8f861c5f04 --- /dev/null +++ b/test/SILOptimizer/zeroInitializer.swift @@ -0,0 +1,44 @@ +// RUN: %target-swift-frontend -O -parse-stdlib -emit-ir -module-name ZeroInit -verify %s | %FileCheck %s + +import Swift + +@frozen +public struct TestInt { + @usableFromInline + var _value : Builtin.Int32 + @_transparent + public init() { + _value = Builtin.zeroInitializer() + } +} + +@frozen +public struct TestFloat { + @usableFromInline + var _value : Builtin.FPIEEE32 + @_transparent + public init() { + _value = Builtin.zeroInitializer() + } +} + +@frozen +public struct TestVector { + @usableFromInline + var _value : Builtin.Vec4xFPIEEE32 + @_transparent + public init() { + _value = Builtin.zeroInitializer() + } +} + +public struct Foo { + public static var x : TestInt = TestInt() + public static var y : TestFloat = TestFloat() + public static var z : TestVector = TestVector() +} + +// CHECK: @"$s8ZeroInit3FooV1xAA7TestIntVvpZ" ={{.*}} global %T8ZeroInit7TestIntV zeroinitializer +// CHECK: @"$s8ZeroInit3FooV1yAA9TestFloatVvpZ" ={{.*}} global %T8ZeroInit9TestFloatV zeroinitializer +// CHECK: @"$s8ZeroInit3FooV1zAA10TestVectorVvpZ" ={{.*}} global %T8ZeroInit10TestVectorV zeroinitializer +// CHECK-NOT: swift_once diff --git a/test/Sema/diag_non_ephemeral.swift b/test/Sema/diag_non_ephemeral.swift index 7a545b300e73d..8445dd00e9272 100644 --- a/test/Sema/diag_non_ephemeral.swift +++ b/test/Sema/diag_non_ephemeral.swift @@ -23,11 +23,11 @@ var optionalArr: [Int8]? // We cannot use array-to-pointer and string-to-pointer conversions with // non-ephemeral parameters. -takesMutableRaw(&arr, 5) // expected-error {{cannot use inout expression here; argument #1 must be a pointer that outlives the call to 'takesMutableRaw'}} +takesMutableRaw(&arr, 5) // expected-error {{cannot use inout expression here; argument #1 must be a pointer that outlives the call to 'takesMutableRaw'}} {{educational-notes=temporary-pointers}} // expected-note@-1 {{implicit argument conversion from '[Int8]' to 'UnsafeMutableRawPointer' produces a pointer valid only for the duration of the call to 'takesMutableRaw'}} // expected-note@-2 {{use the 'withUnsafeMutableBytes' method on Array in order to explicitly convert argument to buffer pointer valid for a defined scope}} -takesConst(str, 5) // expected-error {{cannot pass 'String' to parameter; argument #1 must be a pointer that outlives the call to 'takesConst'}} +takesConst(str, 5) // expected-error {{cannot pass 'String' to parameter; argument #1 must be a pointer that outlives the call to 'takesConst'}} {{educational-notes=temporary-pointers}} // expected-note@-1 {{implicit argument conversion from 'String' to 'UnsafePointer' produces a pointer valid only for the duration of the call to 'takesConst'}} // expected-note@-2 {{use the 'withCString' method on String in order to explicitly convert argument to pointer valid for a defined scope}} diff --git a/test/SourceKit/CodeComplete/complete_from_system.swift b/test/SourceKit/CodeComplete/complete_from_system.swift new file mode 100644 index 0000000000000..cf6809f4d4f7e --- /dev/null +++ b/test/SourceKit/CodeComplete/complete_from_system.swift @@ -0,0 +1,22 @@ +struct MyCollection : Collection { + var startIndex: Int { 0 } + var endIndex: Int { 0 } + func index(after i: Int) -> Int { i + 1 } + subscript(position: Int) -> Int { 0 } +} + +func test(col: MyCollection) { + col. +} + +// RUN: %sourcekitd-test -req=complete -pos=9:7 %s -- %s -module-name TestMod | %FileCheck %s + +// CHECK: key.name: "makeIterator()", +// CHECK-NOT: }, +// CHECK: key.is_system: 1 +// CHECK: }, + +// CHECK: key.name: "startIndex", +// CHECK-NOT: }, +// CHECK-NOT: key.is_system: 1 +// CHECK: }, diff --git a/test/stdlib/UnsafePointerDiagnostics_warning.swift b/test/stdlib/UnsafePointerDiagnostics_warning.swift index 243fa46c97572..180f12d0d892f 100644 --- a/test/stdlib/UnsafePointerDiagnostics_warning.swift +++ b/test/stdlib/UnsafePointerDiagnostics_warning.swift @@ -9,7 +9,7 @@ func unsafePointerInitEphemeralConversions() { var optionalArr: [Int]? = [0] var c: C? - _ = UnsafePointer(&foo) // expected-warning {{initialization of 'UnsafePointer' results in a dangling pointer}} + _ = UnsafePointer(&foo) // expected-warning {{initialization of 'UnsafePointer' results in a dangling pointer}} {{educational-notes=temporary-pointers}} // expected-note@-1 {{implicit argument conversion from 'Int' to 'UnsafePointer' produces a pointer valid only for the duration of the call to 'init(_:)'}} // expected-note@-2 {{use 'withUnsafePointer' in order to explicitly convert argument to pointer valid for a defined scope}} diff --git a/tools/SourceKit/include/SourceKit/Core/LangSupport.h b/tools/SourceKit/include/SourceKit/Core/LangSupport.h index cb3b13d3fabd5..21cc95187171b 100644 --- a/tools/SourceKit/include/SourceKit/Core/LangSupport.h +++ b/tools/SourceKit/include/SourceKit/Core/LangSupport.h @@ -93,6 +93,7 @@ struct CodeCompletionInfo { UIdent TypeRelation; Optional ModuleImportDepth; bool NotRecommended; + bool IsSystem; unsigned NumBytesToErase; struct IndexRange { diff --git a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp index dde9cd6029d26..2a9d593bf1a54 100644 --- a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp +++ b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp @@ -1315,10 +1315,11 @@ Completion *CompletionBuilder::finish() { if (current.getKind() == SwiftResult::Declaration) { base = SwiftResult( semanticContext, current.getNumBytesToErase(), completionString, - current.getAssociatedDeclKind(), current.getModuleName(), - current.isNotRecommended(), current.getNotRecommendedReason(), - current.getBriefDocComment(), current.getAssociatedUSRs(), - current.getDeclKeywords(), typeRelation, opKind); + current.getAssociatedDeclKind(), current.isSystem(), + current.getModuleName(), current.isNotRecommended(), + current.getNotRecommendedReason(), current.getBriefDocComment(), + current.getAssociatedUSRs(), current.getDeclKeywords(), + typeRelation, opKind); } else { base = SwiftResult(current.getKind(), semanticContext, current.getNumBytesToErase(), completionString, diff --git a/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp b/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp index 7ba24a9906b0a..6b1b35b5e82b4 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp @@ -544,6 +544,7 @@ bool SwiftToSourceKitCompletionAdapter::handleResult( Info.ModuleName = Result->getModuleName(); Info.DocBrief = Result->getBriefDocComment(); Info.NotRecommended = Result->isNotRecommended(); + Info.IsSystem = Result->isSystem(); Info.NumBytesToErase = Result->getNumBytesToErase(); diff --git a/tools/SourceKit/tools/sourcekitd/include/sourcekitd/CodeCompletionResultsArray.h b/tools/SourceKit/tools/sourcekitd/include/sourcekitd/CodeCompletionResultsArray.h index 9643ceaeee900..b8c6b0076c364 100644 --- a/tools/SourceKit/tools/sourcekitd/include/sourcekitd/CodeCompletionResultsArray.h +++ b/tools/SourceKit/tools/sourcekitd/include/sourcekitd/CodeCompletionResultsArray.h @@ -35,6 +35,7 @@ class CodeCompletionResultsArrayBuilder { SourceKit::UIdent SemanticContext, SourceKit::UIdent TypeRelation, bool NotRecommended, + bool IsSystem, unsigned NumBytesToErase); std::unique_ptr createBuffer(); diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/CodeCompletionResultsArray.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/CodeCompletionResultsArray.cpp index d89ff2af49041..5e9260a6bc786 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/CodeCompletionResultsArray.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/CodeCompletionResultsArray.cpp @@ -32,6 +32,7 @@ struct CodeCompletionResultsArrayBuilder::Implementation { Optional, UIdent, UIdent, + uint8_t, uint8_t> Builder; }; @@ -56,10 +57,15 @@ void CodeCompletionResultsArrayBuilder::add( UIdent SemanticContext, UIdent TypeRelation, bool NotRecommended, + bool IsSystem, unsigned NumBytesToErase) { - assert(NumBytesToErase <= (uint8_t(-1) >> 1)); - uint8_t BytesAndNotRecommended = (NumBytesToErase << 1) | NotRecommended; + uint8_t Flags = 0; + Flags |= NotRecommended << 1; + Flags |= IsSystem << 0; + + assert(NumBytesToErase <= uint8_t(-1)); + Impl.Builder.addEntry(Kind, Name, Description, @@ -70,7 +76,8 @@ void CodeCompletionResultsArrayBuilder::add( AssocUSRs, SemanticContext, TypeRelation, - BytesAndNotRecommended); + Flags, + uint8_t(NumBytesToErase)); } std::unique_ptr @@ -93,6 +100,7 @@ class CodeCompletionResultsArray { const char *, sourcekitd_uid_t, sourcekitd_uid_t, + uint8_t, uint8_t> CompactArrayReaderTy; static bool @@ -111,7 +119,8 @@ class CodeCompletionResultsArray { const char *AssocUSRs; sourcekitd_uid_t SemanticContext; sourcekitd_uid_t TypeRelation; - uint8_t BytesAndNotRecommended; + uint8_t Flags; + uint8_t NumBytesToErase; Reader.readEntries(Index, Kind, @@ -124,10 +133,11 @@ class CodeCompletionResultsArray { AssocUSRs, SemanticContext, TypeRelation, - BytesAndNotRecommended); + Flags, + NumBytesToErase); - unsigned NumBytesToErase = BytesAndNotRecommended >> 1; - bool NotRecommended = BytesAndNotRecommended & 0x1; + bool NotRecommended = Flags & 0x2; + bool IsSystem = Flags & 0x1; #define APPLY(K, Ty, Field) \ do { \ @@ -156,6 +166,9 @@ class CodeCompletionResultsArray { if (NotRecommended) { APPLY(KeyNotRecommended, Bool, NotRecommended); } + if (IsSystem) { + APPLY(KeyIsSystem, Bool, IsSystem); + } return true; } diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp index 265448f769415..12e8cbe36afcf 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp @@ -2008,6 +2008,7 @@ bool SKCodeCompletionConsumer::handleResult(const CodeCompletionInfo &R) { R.SemanticContext, R.TypeRelation, R.NotRecommended, + R.IsSystem, R.NumBytesToErase); return true; } @@ -2183,6 +2184,8 @@ bool SKGroupedCodeCompletionConsumer::handleResult(const CodeCompletionInfo &R) result.set(KeyModuleImportDepth, *R.ModuleImportDepth); if (R.NotRecommended) result.set(KeyNotRecommended, R.NotRecommended); + if (R.IsSystem) + result.set(KeyIsSystem, R.IsSystem); result.set(KeyNumBytesToErase, R.NumBytesToErase); if (R.descriptionStructure) { diff --git a/userdocs/diagnostics/temporary-pointers.md b/userdocs/diagnostics/temporary-pointers.md new file mode 100644 index 0000000000000..feee3e798bd02 --- /dev/null +++ b/userdocs/diagnostics/temporary-pointers.md @@ -0,0 +1,64 @@ +# Temporary Pointers +A temporary, or ephemeral, pointer in Swift is a pointer which is introduced by an implicit function argument conversion and is only valid for the lifetime of the function call it appears in. There are a few ways to create a temporary pointer: + +- Using an inout-to-pointer conversion by passing an argument with `&`: + + ```swift + func foo(bar: UnsafePointer) { /*...*/ } + var x: Int = 42 + foo(bar: &x) + ``` + + In the example above, the `bar` passed to `foo` is a temporary pointer to `x` which is only valid until `foo` returns. + + Not all inout-to-pointer conversions result in a temporary pointer. Passing global variables and static properties inout can produce non-ephemeral pointers, as long as they are stored and have no observers. Additionally, if they are of a tuple or struct type, their stored members without observers may also be passed inout as non-ephemeral pointers. + +- Using a string-to-pointer conversion: + + ```swift + func foo(bar: UnsafePointer) { /*...*/ } + var x: String = "hello, world!" + foo(bar: x) + ``` + + In the example above, the `bar` passed to `foo` is a temporary pointer to a buffer containing the UTF-8 code units of `x` which is only valid until `foo` returns. + +- Using an array-to-pointer conversion: + + ```swift + func foo(bar: UnsafePointer) { /*...*/ } + var x: [Bool] = [true, false, true] + foo(bar: x) + ``` + + In the example above, the `bar` passed to `foo` is a temporary pointer to the elements of `x` which is only valid until `foo` returns. + +Temporary pointers may only be passed as arguments to functions which do not store the pointer value or otherwise allow it to escape the function's scope. The Swift compiler is able to diagnose some, but not all, violations of this rule. Misusing a temporary pointer by allowing it to outlive the enclosing function call results in undefined behavior. For example, consider the following incorrect code: + +```swift +var x = 42 +let ptr = UnsafePointer(&x) +// Do something with ptr. +``` + +This code is invalid because the initializer of `UnsafePointer` stores its argument, causing it to outlive the `UnsafePointer` initializer call. Instead, this code should use `withUnsafePointer` to access a pointer to `x` with an explicitly defined scope: + +```swift +var x = 42 +withUnsafePointer(to: &x) { ptr in + // Do something with ptr, but don't allow it to escape this closure! +} +``` + +It's important to note that the `withUnsafe*` functions can also result in undefined behavior if used improperly. For example, the following incorrect code is equivalent to the original temporary pointer example: + +```swift +var x = 42 +let ptr = withUnsafePointer(to: &x) { $0 } +// Do something with ptr. +``` + +This code is invalid because the pointer to `x` is only valid until `withUnsafePointer` returns, but it escapes the closure when it is returned and assigned to `ptr`. + +To learn more about correctly using unsafe pointer APIs, see the Swift standard library documentation of `UnsafePointer` and related types. + diff --git a/validation-test/IDE/complete_from_cocoa.swift b/validation-test/IDE/complete_from_cocoa.swift index e392023ff2198..2a68a19f3d96e 100644 --- a/validation-test/IDE/complete_from_cocoa.swift +++ b/validation-test/IDE/complete_from_cocoa.swift @@ -13,8 +13,8 @@ import Cocoa func testUnqualified() { #^T1^# // T1: Begin completions -// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]: CFArrayCreate({#(allocator): CFAllocator!#}, {#(values): UnsafeMutablePointer!#}, {#(numValues): CFIndex#}, {#(callBacks): UnsafePointer!#})[#CFArray!#]{{; name=.+$}} -// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]: CFArrayGetCount({#(theArray): CFArray!#})[#CFIndex#]{{; name=.+$}} -// T1-DAG: Decl[Class]/OtherModule[ObjectiveC.NSObject]: NSObject[#NSObject#]{{; name=.+$}} +// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]/IsSystem: CFArrayCreate({#(allocator): CFAllocator!#}, {#(values): UnsafeMutablePointer!#}, {#(numValues): CFIndex#}, {#(callBacks): UnsafePointer!#})[#CFArray!#]{{; name=.+$}} +// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]/IsSystem: CFArrayGetCount({#(theArray): CFArray!#})[#CFIndex#]{{; name=.+$}} +// T1-DAG: Decl[Class]/OtherModule[ObjectiveC.NSObject]/IsSystem: NSObject[#NSObject#]{{; name=.+$}} // T1: End completions } diff --git a/validation-test/IDE/complete_from_cocoa_2.swift b/validation-test/IDE/complete_from_cocoa_2.swift index b0236426fc7ee..ce8e64546567c 100644 --- a/validation-test/IDE/complete_from_cocoa_2.swift +++ b/validation-test/IDE/complete_from_cocoa_2.swift @@ -13,17 +13,17 @@ import Cocoa func testQualifiedWithDot() { Cocoa.#^T1^# // T1: Begin completions -// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]: CFArrayCreate({#(allocator): CFAllocator!#}, {#(values): UnsafeMutablePointer!#}, {#(numValues): CFIndex#}, {#(callBacks): UnsafePointer!#})[#CFArray!#]{{; name=.+$}} -// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]: CFArrayGetCount({#(theArray): CFArray!#})[#CFIndex#]{{; name=.+$}} -// T1-DAG: Decl[Class]/OtherModule[ObjectiveC.NSObject]: NSObject[#NSObject#]{{; name=.+$}} +// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]/IsSystem: CFArrayCreate({#(allocator): CFAllocator!#}, {#(values): UnsafeMutablePointer!#}, {#(numValues): CFIndex#}, {#(callBacks): UnsafePointer!#})[#CFArray!#]{{; name=.+$}} +// T1-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]/IsSystem: CFArrayGetCount({#(theArray): CFArray!#})[#CFIndex#]{{; name=.+$}} +// T1-DAG: Decl[Class]/OtherModule[ObjectiveC.NSObject]/IsSystem: NSObject[#NSObject#]{{; name=.+$}} // T1: End completions } func testQualifiedWithoutDot() { Cocoa#^T2^# // T2: Begin completions -// T2-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]: .CFArrayCreate({#(allocator): CFAllocator!#}, {#(values): UnsafeMutablePointer!#}, {#(numValues): CFIndex#}, {#(callBacks): UnsafePointer!#})[#CFArray!#]{{; name=.+$}} -// T2-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]: .CFArrayGetCount({#(theArray): CFArray!#})[#CFIndex#]{{; name=.+$}} -// T2-DAG: Decl[Class]/OtherModule[ObjectiveC.NSObject]: .NSObject[#NSObject#]{{; name=.+$}} +// T2-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]/IsSystem: .CFArrayCreate({#(allocator): CFAllocator!#}, {#(values): UnsafeMutablePointer!#}, {#(numValues): CFIndex#}, {#(callBacks): UnsafePointer!#})[#CFArray!#]{{; name=.+$}} +// T2-DAG: Decl[FreeFunction]/OtherModule[CoreFoundation.CFArray]/IsSystem: .CFArrayGetCount({#(theArray): CFArray!#})[#CFIndex#]{{; name=.+$}} +// T2-DAG: Decl[Class]/OtherModule[ObjectiveC.NSObject]/IsSystem: .NSObject[#NSObject#]{{; name=.+$}} // T2: End completions } diff --git a/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift b/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift index cc292aa532c60..2d68d98ee60af 100644 --- a/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift +++ b/validation-test/IDE/crashers_fixed/subexpr-literal-in-sequence-expr.swift @@ -8,4 +8,4 @@ func test2() { "" + [""]#^B^# } // Sanity check results. -// CHECK: Decl[InstanceVar]/CurrNominal: .startIndex[#Int#]; name=startIndex +// CHECK: Decl[InstanceVar]/CurrNominal/IsSystem: .startIndex[#Int#]; name=startIndex