content stringlengths 1 103k ⌀ | path stringlengths 8 216 | filename stringlengths 2 179 | language stringclasses 15
values | size_bytes int64 2 189k | quality_score float64 0.5 0.95 | complexity float64 0 1 | documentation_ratio float64 0 1 | repository stringclasses 5
values | stars int64 0 1k | created_date stringdate 2023-07-10 19:21:08 2025-07-09 19:11:45 | license stringclasses 4
values | is_test bool 2
classes | file_hash stringlengths 32 32 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s\n// REQUIRES: objc_interop\n\nimport Foundation\n\nstruct NotClass {}\n\nclass SomeClass {}\n\nfunc nsobject_as_class_cast<T>(_ x: NSObject, _: T) {\n let _ = x is AnyObject.Type\n let _ = x as! AnyObject.Type\n let _ = x as? AnyObje... | dataset_sample\swift\apple_swift\test\Constraints\casts_objc.swift | casts_objc.swift | Swift | 3,488 | 0.95 | 0.040816 | 0.088608 | vue-tools | 871 | 2024-11-08T22:25:07.584737 | Apache-2.0 | true | eae9747cd10d94af6e8fd3b8bb2b9a3d |
// RUN: %target-typecheck-verify-swift -enable-objc-interop -swift-version 6\n\nfunc id<T>(_ x: T) -> T { x }\nfunc ohno<T>(_ x: T) -> T? { nil }\n\n// Swift 6 version of the test in casts.swift\nfunc test_compatibility_coercions(_ arr: [Int], _ optArr: [Int]?, _ dict: [String: Int], _ set: Set<Int>, _ i: Int, _ string... | dataset_sample\swift\apple_swift\test\Constraints\casts_swift6.swift | casts_swift6.swift | Swift | 5,864 | 0.95 | 0.040541 | 0.365079 | awesome-app | 691 | 2024-06-03T11:22:31.292524 | MIT | true | 9bf1ff193b85fa9d4ecc4168170a34c2 |
// RUN: %target-typecheck-verify-swift\n\nclass A { }\nclass B : A { }\nclass C : B { }\nclass D : B { }\n\nclass E<T> : D { }\nclass F<T> : E<[T]> { }\n\nvar a : A\nvar b : B\nvar c : C\nvar d : D\nvar ef : E<Float> \nvar fi : F<Int>\n\nfunc f0(_ b : B) {}\n\nfunc ternary<T>(_ cond: Bool,\n _ ifTrue: @a... | dataset_sample\swift\apple_swift\test\Constraints\class.swift | class.swift | Swift | 660 | 0.95 | 0.195122 | 0.068966 | node-utils | 522 | 2024-09-03T12:30:29.104854 | MIT | true | 65be1fb466b37ac61e78948a1087fd6e |
// RUN: %target-typecheck-verify-swift %clang-importer-sdk\n// RUN: %target-swift-emit-silgen(mock-sdk: %clang-importer-sdk) -verify %s\n// REQUIRES: objc_interop\n\nimport Foundation\n\nfunc f(_: [AnyObject]) {}\nfunc g(_: [Protocol]) {}\n\nf([NSString.self, NSObject.self])\n\n@objc protocol P: AnyObject {}\n@objc pro... | dataset_sample\swift\apple_swift\test\Constraints\class_to_object_in_collection.swift | class_to_object_in_collection.swift | Swift | 407 | 0.95 | 0 | 0.230769 | react-lib | 620 | 2023-12-02T06:59:17.282332 | BSD-3-Clause | true | 91de5d7cc6a4e2f484b4a5a3f9fbc2c5 |
// RUN: %target-typecheck-verify-swift\n\nfunc myMap<T1, T2>(_ array: [T1], _ fn: (T1) -> T2) -> [T2] {}\n\nvar intArray : [Int]\n\n_ = myMap(intArray, { String($0) })\n_ = myMap(intArray, { x -> String in String(x) } )\n\n// Closures with too few parameters.\nfunc foo(_ x: (Int, Int) -> Int) {}\nfoo({$0}) // expected-... | dataset_sample\swift\apple_swift\test\Constraints\closures.swift | closures.swift | Swift | 45,118 | 0.95 | 0.065721 | 0.189623 | react-lib | 837 | 2025-03-24T21:48:03.841337 | BSD-3-Clause | true | 6a57acfc451d9509d92a288fe177981c |
// RUN: %target-swift-frontend -emit-sil %s\n\nstruct S {\n func foo<R>(_ body: () -> R) -> R {\n fatalError()\n }\n}\n\n// Make sure we insert an implicit return at the end of the body.\nfunc bar(x: S?) {\n x?.foo {\n if .random() { return }\n }\n}\n | dataset_sample\swift\apple_swift\test\Constraints\closure_optional_chain.swift | closure_optional_chain.swift | Swift | 247 | 0.8 | 0.071429 | 0.166667 | node-utils | 971 | 2024-11-12T23:54:52.116173 | Apache-2.0 | true | d94be8235f1cebbce02be4d8365cc360 |
// RUN: %target-typecheck-verify-swift\n\n// rdar://113745963\n\n// https://github.com/apple/swift/pull/67441 changed closure resolution order which makes the following code fail to type-check.\n\nstruct Date : Equatable {\n static var distantPast = Date()\n}\n\nenum Request {\n struct Options: OptionSet {\n stati... | dataset_sample\swift\apple_swift\test\Constraints\closure_resolution_order.swift | closure_resolution_order.swift | Swift | 1,409 | 0.8 | 0.032787 | 0.06 | react-lib | 892 | 2025-03-05T21:29:27.095713 | GPL-3.0 | true | ea261f35aea71823f265bf9396ac78ae |
// RUN: %target-typecheck-verify-swift\n\n// rdar://problem/29954938 -- A bug in associated type inference exposed an\n// order dependency where, if a type conformed to Collection in one extension\n// then conformed to MutableCollection in a later extension, it would fail\n// to type-check.\n\nstruct Butz { }\n\nextens... | dataset_sample\swift\apple_swift\test\Constraints\collection-mutablecollection-order-dependency-1.swift | collection-mutablecollection-order-dependency-1.swift | Swift | 613 | 0.8 | 0.047619 | 0.294118 | python-kit | 920 | 2024-09-19T00:44:02.864952 | MIT | true | 5396b5aeadfdb379378627055a2a8b77 |
// RUN: %target-typecheck-verify-swift\n\n// rdar://problem/29954938 -- A bug in associated type inference exposed an\n// order dependency where, if a type conformed to Collection in one extension\n// then conformed to MutableCollection in a later extension, it would fail\n// to type-check.\n\nstruct Butz<Flubz: Compar... | dataset_sample\swift\apple_swift\test\Constraints\collection-mutablecollection-order-dependency-1g.swift | collection-mutablecollection-order-dependency-1g.swift | Swift | 660 | 0.8 | 0.047619 | 0.294118 | vue-tools | 402 | 2024-11-29T10:32:11.398469 | BSD-3-Clause | true | 7311823391d6f69da5c3cf20b148d270 |
// RUN: %target-typecheck-verify-swift\n\n// rdar://problem/29954938 -- A bug in associated type inference exposed an\n// order dependency where, if a type conformed to Collection in one extension\n// then conformed to MutableCollection in a later extension, it would fail\n// to type-check. This regression test ensures... | dataset_sample\swift\apple_swift\test\Constraints\collection-mutablecollection-order-dependency-2.swift | collection-mutablecollection-order-dependency-2.swift | Swift | 723 | 0.8 | 0.045455 | 0.333333 | node-utils | 177 | 2024-05-31T00:25:02.321575 | MIT | true | 9cd285435ae106c8a19c47216ee0d43f |
// RUN: %target-typecheck-verify-swift\n\n// rdar://problem/29954938 -- A bug in associated type inference exposed an\n// order dependency where, if a type conformed to Collection in one extension\n// then conformed to MutableCollection in a later extension, it would fail\n// to type-check. This regression test ensures... | dataset_sample\swift\apple_swift\test\Constraints\collection-mutablecollection-order-dependency-3.swift | collection-mutablecollection-order-dependency-3.swift | Swift | 728 | 0.8 | 0.045455 | 0.333333 | vue-tools | 948 | 2025-04-10T15:12:16.870102 | Apache-2.0 | true | 6abfe34e96767fce9f6b7b06fa59b9f3 |
// RUN: %target-typecheck-verify-swift\n\nfunc foo(_:[() -> ()]){}\nfunc foo(_:[() throws -> ()]){}\n\nfunc x() {}\n\nvar bs = [x]\n\nfoo(bs)\n | dataset_sample\swift\apple_swift\test\Constraints\collection-of-function.swift | collection-of-function.swift | Swift | 133 | 0.8 | 0 | 0.166667 | awesome-app | 279 | 2023-10-04T02:27:52.475043 | BSD-3-Clause | true | e675566519f89ff19994af9e4b355842 |
// RUN: %target-typecheck-verify-swift -debug-constraints 2>%t.err\n// RUN: %FileCheck %s < %t.err\n\nstruct X {\n func g(_: Int) -> Int { return 0 }\n func g(_: Double) -> Int { return 0 }\n\n subscript(_: Int) -> String { return "" }\n subscript(_: Double) -> String { return "" }\n\n func iuo(_: Int) -> Int! { r... | dataset_sample\swift\apple_swift\test\Constraints\common_type.swift | common_type.swift | Swift | 2,277 | 0.95 | 0.107143 | 0.287879 | awesome-app | 433 | 2024-11-03T19:35:51.732607 | BSD-3-Clause | true | 7512e5a6c801ffb9900451a7107b2d70 |
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s -debug-constraints 2>%t.err\n// RUN: %FileCheck %s < %t.err\n\n// REQUIRES: objc_interop\n\nimport Foundation\n\n@objc protocol P {\n func foo(_ i: Int) -> Double // expected-note {{'foo' previously declared here}}\n func foo(_ d: Dou... | dataset_sample\swift\apple_swift\test\Constraints\common_type_objc.swift | common_type_objc.swift | Swift | 1,012 | 0.95 | 0.090909 | 0.3125 | vue-tools | 797 | 2023-08-25T10:04:03.003973 | MIT | true | 68d585e004b1620f2356624cf7b989c2 |
// RUN: %target-typecheck-verify-swift\n\ninfix operator +++ : AdditionPrecedence\ninfix operator *** : MultiplicationPrecedence\n\nprotocol P {\n static func +++ (lhs: Self, rhs: Self) -> Self\n}\n\nextension P {\n static func +++ (lhs: Self, rhs: Self) -> Self {\n return lhs\n }\n}\n\nprotocol Q {\n static fun... | dataset_sample\swift\apple_swift\test\Constraints\concrete-overload-required.swift | concrete-overload-required.swift | Swift | 951 | 0.95 | 0 | 0.083333 | awesome-app | 677 | 2023-12-04T11:28:25.112978 | BSD-3-Clause | true | 868bebd310ad45c8762e5b457b23be2b |
// RUN: %target-typecheck-verify-swift\n\nprotocol P {}\nstruct X: P {}\nstruct Y {}\n\nprotocol AssociatedType {\n associatedtype T\n}\nstruct Z1: AssociatedType {\n typealias T = X\n}\nstruct Z2: AssociatedType {\n typealias T = Y\n}\n\nstruct SameType<T> {}\nextension SameType where T == X { // expected-not... | dataset_sample\swift\apple_swift\test\Constraints\conditionally_defined_types.swift | conditionally_defined_types.swift | Swift | 12,603 | 0.95 | 0.021186 | 0.066667 | awesome-app | 619 | 2023-10-03T23:50:38.622619 | GPL-3.0 | true | d01f06b5fb046ad9e4900b1e00778efa |
// RUN: %target-typecheck-verify-swift\n\nstruct X {\n var i : Int, j : Int\n}\n\nstruct Y {\n init (_ x : Int, _ y : Float, _ z : String) {}\n}\n\nenum Z {\n case none\n case char(UnicodeScalar)\n case string(String)\n case point(Int, Int)\n\n init() { self = .none }\n init(_ c: UnicodeScalar) { self = .char(c... | dataset_sample\swift\apple_swift\test\Constraints\construction.swift | construction.swift | Swift | 7,534 | 0.95 | 0.04 | 0.153527 | awesome-app | 371 | 2024-01-17T22:00:09.999764 | GPL-3.0 | true | 17e565eab0e0662f8fa2781cdb2bf614 |
// RUN: %target-typecheck-verify-swift\n\nfunc acceptInt(_ : inout Int) {}\nfunc acceptDouble(_ : inout Double) {}\n\nvar i1 = 1\nacceptInt(&i1)\nvar i2 = 1 + 2.0 + 1\nacceptDouble(&i2)\n\n\nfunc ternary<T>(_ cond: Bool,\n _ ifTrue: @autoclosure () -> T,\n _ ifFalse: @autoclosure () -> T) ... | dataset_sample\swift\apple_swift\test\Constraints\default_literals.swift | default_literals.swift | Swift | 920 | 0.8 | 0 | 0.09375 | awesome-app | 839 | 2024-05-02T10:33:38.020808 | BSD-3-Clause | true | 5c1b5ce7e1664225e4629130fedacfb7 |
// RUN: %target-typecheck-verify-swift -swift-version 4\n\n// Swift 3 used default literal types even for normal protocol constraints,\n// which led to nonsensical type inference behavior.\n\n// expected-note@+1{{in call to function 'f'}}\nfunc f<T: ExpressibleByIntegerLiteral>(_: T = 0) { }\n\nf() // expected-error{{g... | dataset_sample\swift\apple_swift\test\Constraints\default_literals_swift4.swift | default_literals_swift4.swift | Swift | 635 | 0.95 | 0.117647 | 0.5 | vue-tools | 525 | 2024-12-10T07:22:14.148905 | BSD-3-Clause | true | d74d9a9541420a81339b94a5464ea078 |
// RUN: %target-typecheck-verify-swift\n\nprotocol P {\n associatedtype V\n}\n\nstruct Person {\n var name: String = ""\n}\n\nstruct Row : P {\n typealias V = String\n init(_: V) {}\n}\n\nfunc foo<C: Collection, R: P>(_ collection: C, _: (C.Element.V) -> R) where C.Element: P { }\n// expected-note@-1 {{where 'C.E... | dataset_sample\swift\apple_swift\test\Constraints\dependent_type_requirement_failure.swift | dependent_type_requirement_failure.swift | Swift | 487 | 0.95 | 0.041667 | 0.111111 | vue-tools | 297 | 2024-10-24T09:01:58.009677 | BSD-3-Clause | true | 2628fccc18d38b7454d1af641d183be1 |
// RUN: %target-typecheck-verify-swift\n\nprotocol P {\n associatedtype SomeType\n}\n\nprotocol P2 { \n func wonka()\n}\n\nextension Int : P {\n typealias SomeType = Int\n}\n\nextension Double : P {\n typealias SomeType = Double\n}\n\nfunc f0(_ x: Int, \n _ y: Float) { }\n\nfunc f1(_: @escaping (Int, Float) ... | dataset_sample\swift\apple_swift\test\Constraints\diagnostics.swift | diagnostics.swift | Swift | 75,077 | 0.75 | 0.114557 | 0.250397 | vue-tools | 310 | 2024-09-21T02:59:56.802587 | Apache-2.0 | true | b168d9260ecbc9da25e89746d4a95e29 |
// RUN: %target-typecheck-verify-swift -swift-version 4\n\n// https://github.com/apple/swift/issues/45110\n// Call arguments did not match up assertion\n\nfunc f_45110(_ a: Any) {} // expected-note {{}}\ndo {\n f_45110() // expected-error {{missing argument for parameter #1 in call}}\n f_45110(a: 1) // expe... | dataset_sample\swift\apple_swift\test\Constraints\diagnostics_swift4.swift | diagnostics_swift4.swift | Swift | 1,818 | 0.95 | 0.101695 | 0.2 | python-kit | 165 | 2023-09-23T08:19:49.955665 | BSD-3-Clause | true | bedcb6cb379562a01a5b27db314684e6 |
// RUN: %target-typecheck-verify-swift -swift-version 5\n\nfunc f0(_ i: Int, _ d: Double) {} // expected-note{{found this candidate}}\nfunc f0(_ d: Double, _ i: Int) {} // expected-note{{found this candidate}}\n\nf0(1, 2) // expected-error{{ambiguous use of 'f0'}}\n\nfunc f1(_ i: Int16) {} // expected-note{{found this ... | dataset_sample\swift\apple_swift\test\Constraints\diag_ambiguities.swift | diag_ambiguities.swift | Swift | 4,050 | 0.95 | 0.042735 | 0.147727 | awesome-app | 700 | 2025-06-30T07:56:22.625787 | Apache-2.0 | true | 90c4b11cbf7710e587bc8f10d9fa9da4 |
// RUN: %empty-directory(%t)\n// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/has_ambiguities.swift\n// RUN: not %target-swift-frontend -typecheck %s -I %t 2>&1 | %FileCheck %s\n\nimport has_ambiguities\n\nmaybeTrans(0) // expected-error{{ambiguous use of 'maybeTrans'}}\n// CHECK: ambiguous use of 'maybeTra... | dataset_sample\swift\apple_swift\test\Constraints\diag_ambiguities_module.swift | diag_ambiguities_module.swift | Swift | 521 | 0.95 | 0 | 0.846154 | react-lib | 756 | 2024-06-02T05:55:38.467025 | GPL-3.0 | true | 59336893fd5816d9a4a87ba9318b06cc |
// RUN: %target-typecheck-verify-swift\n\nfunc nonNamedFunc(_ x: Int) {} // expected-note * {{here}}\nnonNamedFunc() // expected-error {{missing argument for parameter #1 in call}} {{14-14=<#Int#>}}\n\nfunc namedFunc(x: Int) {} // expected-note * {{here}}\nnamedFunc() // expected-error {{missing argument for parameter ... | dataset_sample\swift\apple_swift\test\Constraints\diag_missing_arg.swift | diag_missing_arg.swift | Swift | 11,283 | 0.95 | 0.426136 | 0.082759 | python-kit | 365 | 2023-12-22T10:20:40.790797 | MIT | true | 886a3ada1dd558d68075d1b65e9b9733 |
// RUN: %target-typecheck-verify-swift\n\nfinal class DictStringInt : ExpressibleByDictionaryLiteral {\n typealias Key = String\n typealias Value = Int\n init(dictionaryLiteral elements: (String, Int)...) { }\n}\n\nfinal class MyDictionary<K, V> : ExpressibleByDictionaryLiteral {\n typealias Key = K\n typealias Va... | dataset_sample\swift\apple_swift\test\Constraints\dictionary_literal.swift | dictionary_literal.swift | Swift | 11,292 | 0.95 | 0.05 | 0.342105 | node-utils | 636 | 2025-01-14T14:00:01.633597 | MIT | true | 1761e285ae8383e0ab50416beba79fed |
// RUN: %empty-directory(%t)\n// RUN: %build-clang-importer-objc-overlays\n// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -import-objc-header %S/Inputs/disambiguate_iuo_param.h %s -emit-ir | %FileCheck %s\n// -module-name objc_ir -I %S/Inputs/custom-modules -emit-ir -g -o - -primary-file %... | dataset_sample\swift\apple_swift\test\Constraints\disambiguate_iuo_param.swift | disambiguate_iuo_param.swift | Swift | 492 | 0.95 | 0 | 0.777778 | react-lib | 473 | 2024-08-21T22:29:32.048013 | MIT | true | bd0f72e52206c492275c73a13cc3e2f4 |
// RUN: %target-typecheck-verify-swift\n\nstruct A { }\nstruct B { }\n\n@_disfavoredOverload\nfunc f0<T>(_: T) -> A { return A() }\n\nfunc f0(_: Int32) -> B { return B() }\n\n\nfunc f1(_: StaticString) -> B { return B() }\n\n@_disfavoredOverload\nfunc f1<T>(_: T) -> A { return A() }\n\nfunc f2(_: Substring) -> B { retu... | dataset_sample\swift\apple_swift\test\Constraints\disfavored.swift | disfavored.swift | Swift | 665 | 0.8 | 0 | 0.038462 | python-kit | 650 | 2023-12-24T23:15:50.874312 | GPL-3.0 | true | 501f5a28159087e446fd2b1ae4f47cf1 |
// RUN: %empty-directory(%t)\n// RUN: %target-swift-frontend -emit-module %S/Inputs/PrivateObjC.swift -o %t\n// RUN: %target-typecheck-verify-swift -swift-version 4 -I %t -verify-ignore-unknown\n// RUN: %target-typecheck-verify-swift -swift-version 5 -I %t -verify-ignore-unknown\n\n// REQUIRES: objc_interop\n\nimport F... | dataset_sample\swift\apple_swift\test\Constraints\dynamic_lookup.swift | dynamic_lookup.swift | Swift | 15,289 | 0.95 | 0.086066 | 0.19171 | node-utils | 53 | 2025-06-08T05:46:45.332340 | Apache-2.0 | true | 4cbc294d6bf916db4444db7b32ad5541 |
// RUN: %empty-directory(%t)\n// RUN: %target-swift-frontend -emit-module %S/Inputs/PrivateObjC.swift -o %t\n// RUN: %target-typecheck-verify-swift -swift-version 6 -I %t -verify-ignore-unknown\n\n// REQUIRES: objc_interop\n\nimport Foundation\nimport PrivateObjC\n\nfunc test_dynamic_subscript_accepts_type_name_argumen... | dataset_sample\swift\apple_swift\test\Constraints\dynamic_lookup_swift6.swift | dynamic_lookup_swift6.swift | Swift | 1,018 | 0.95 | 0.041667 | 0.421053 | awesome-app | 995 | 2024-07-11T02:27:09.004849 | GPL-3.0 | true | 98178ee914dee088890d3c9a0b87e8ce |
// RUN: %target-typecheck-verify-swift -swift-version 4\n\n// See test/Compatibility/enum_cases.swift for Swift 3 behavior\n\nenum E {\n case foo(bar: String)\n case bar(_: String)\n case two(x: Int, y: Int)\n case tuple((x: Int, y: Int))\n}\n\nenum G_E<T> {\n case foo(bar: T)\n case bar(_: T)\n case two(x: T, y... | dataset_sample\swift\apple_swift\test\Constraints\enum_cases.swift | enum_cases.swift | Swift | 5,662 | 0.95 | 0.045226 | 0.116883 | node-utils | 540 | 2025-03-30T14:25:55.500269 | BSD-3-Clause | true | a36264666642fa9b16d0d6cc9a192933 |
// RUN: %target-swift-frontend %clang-importer-sdk -typecheck %s -verify\n\n// REQUIRES: objc_interop\n\nimport Foundation\n\nenum FooError: HairyError, Runcible {\n case A\n\n var hairiness: Int { return 0 }\n\n func runce() {}\n}\n\nprotocol HairyError : Error {\n var hairiness: Int { get }\n}\n\nprotocol Runcibl... | dataset_sample\swift\apple_swift\test\Constraints\ErrorBridging.swift | ErrorBridging.swift | Swift | 2,643 | 0.95 | 0.040404 | 0.136986 | node-utils | 670 | 2024-03-03T07:30:38.304085 | GPL-3.0 | true | 06d393bbf5255f8c3809c40687e1c200 |
// RUN: %target-typecheck-verify-swift\n\nprotocol P {}\n\nprotocol Q {}\n\nprotocol PP: P {}\n\nvar qp: Q.Protocol\nvar pp: P.Protocol = qp // expected-error{{cannot convert value of type '(any Q).Type' to specified type '(any P).Type'}}\n\nvar qt: Q.Type\nqt = qp // expected-error{{cannot assign value of type '(any Q... | dataset_sample\swift\apple_swift\test\Constraints\existential_metatypes.swift | existential_metatypes.swift | Swift | 4,191 | 0.95 | 0.033058 | 0.044444 | vue-tools | 945 | 2024-12-10T15:36:36.599963 | Apache-2.0 | true | 130db947d5610cd5b77e2140b6192401 |
// RUN: %target-typecheck-verify-swift\n\nfunc f1() -> Int { }\nfunc f2(_: Int = 5) -> Int { }\nfunc f3(_: Int...) -> Int { }\n\nclass A { }\nclass B : A { \n func iAmAB() {}\n func createB() -> B { return B() }\n}\n\nfunc f4() -> B { }\nfunc f5(_ a: A) { }\nfunc f6(_ a: A, _: Int) { }\n\nfunc createB() -> B { }\nfun... | dataset_sample\swift\apple_swift\test\Constraints\fixes.swift | fixes.swift | Swift | 17,533 | 0.95 | 0.142077 | 0.327703 | node-utils | 364 | 2025-02-10T07:23:31.950765 | GPL-3.0 | true | ffce35d1958f8ef29a73f08248d0325c |
// RUN: %target-typecheck-verify-swift\n\nfunc f0(_ x: Float) -> Float {}\nfunc f1(_ x: Float) -> Float {}\nfunc f2(_ x: @autoclosure () -> Float) {}\n\nvar f : Float\n\n_ = f0(f0(f))\n_ = f0(1)\n_ = f1(f1(f))\nf2(f)\nf2(1.0)\n\nfunc call_lvalue(_ rhs: @autoclosure () -> Bool) -> Bool {\n return rhs()\n}\n\n// Functio... | dataset_sample\swift\apple_swift\test\Constraints\function.swift | function.swift | Swift | 10,491 | 0.95 | 0.109155 | 0.168224 | vue-tools | 124 | 2025-03-16T08:36:18.737290 | BSD-3-Clause | true | b563c0bf2fe3690467dbb257459ef000 |
// RUN: %target-typecheck-verify-swift -swift-version 4\n\n// rdar://problem/31969605\n\nclass Base {}\nclass Derived : Base {}\n\nprotocol Refined {}\nprotocol Proto : Refined {}\nextension Base : Refined {}\n\nfunc baseFn(_: Base) {}\n\nfunc superclassConversion(fn: @escaping (Base) -> ()) {\n let _: (Derived) -> ()... | dataset_sample\swift\apple_swift\test\Constraints\function_conversion.swift | function_conversion.swift | Swift | 3,255 | 0.95 | 0.06383 | 0.15942 | awesome-app | 186 | 2025-07-01T18:46:07.639933 | Apache-2.0 | true | 5ecb090c691e7ca2696cd6515478785d |
// RUN: %target-swift-frontend -typecheck %s\n\n// rdar://problem/32618740\n// https://github.com/apple/swift/issues/47696\n\nprotocol InitCollection: Collection {\n init(_ array: [Iterator.Element])\n}\n\nprotocol InitAny {\n init()\n}\n\nextension Array: InitCollection {\n init(_ array: [Iterator.Element]) {\n ... | dataset_sample\swift\apple_swift\test\Constraints\gather_all_adjacencies.swift | gather_all_adjacencies.swift | Swift | 718 | 0.95 | 0.025 | 0.09375 | python-kit | 868 | 2023-10-10T17:19:19.674973 | Apache-2.0 | true | 3c4b40b5af0138dda58e31b7c9c343ee |
// RUN: %target-typecheck-verify-swift -enable-objc-interop\n\ninfix operator +++\n\nprotocol ConcatToAnything { // expected-note {{where 'Self' = 'U'}}\n static func +++ <T>(lhs: Self, other: T)\n}\n\nfunc min<T : Comparable>(_ x: T, y: T) -> T {\n if y < x { return y }\n return x\n}\n\nfunc weirdConcat<T : ConcatT... | dataset_sample\swift\apple_swift\test\Constraints\generics.swift | generics.swift | Swift | 42,909 | 0.95 | 0.045914 | 0.183197 | awesome-app | 165 | 2024-03-25T13:59:04.587364 | GPL-3.0 | true | 2f7c7806ac0827239eb98e4b1a3af72e |
// RUN: %target-typecheck-verify-swift\n\nstruct A<T> {\n // Can deduce from this constructor\n init(x:T) { }\n\n // Can't from this one\n init(x:Int, y:Int) { }\n\n static func bort(_ x: T) -> T { return x }\n}\n\nvar a = A(x: 0)\nvar a1 : A<Int> = a\n\nvar b = A(x: "zero")\nvar b1 : A<String> = b\n\nclass C<T> {... | dataset_sample\swift\apple_swift\test\Constraints\generic_construction_deduction.swift | generic_construction_deduction.swift | Swift | 665 | 0.95 | 0.022727 | 0.166667 | python-kit | 123 | 2024-01-21T22:48:42.261052 | Apache-2.0 | true | 479e30c98d3bdc780c7d105c3b0807aa |
// RUN: %target-typecheck-verify-swift\n\nprotocol P1 { associatedtype Assoc }\nprotocol P2 : P1 { associatedtype Assoc }\nprotocol P3 { }\n\nstruct X1 : P1 { typealias Assoc = X3 }\nstruct X1b : P1 { typealias Assoc = Int }\nstruct X2 : P2 { typealias Assoc = X2 }\nstruct X3 : P3 { }\n\n// Convenience variables\nvar i... | dataset_sample\swift\apple_swift\test\Constraints\generic_overload.swift | generic_overload.swift | Swift | 2,089 | 0.95 | 0.036145 | 0.106061 | vue-tools | 283 | 2024-10-06T19:26:27.399126 | GPL-3.0 | true | 2c3ce9bcbfe6dc39a8f4d6c36572f1d4 |
// RUN: %target-typecheck-verify-swift\n\ninfix operator •\n\nprotocol Runcible { func runce() }\nprotocol Fungible { func funge() }\nprotocol Ansible { func anse() }\n\nprotocol NeedsGenericMethods {\n func oneArgNoConstraints<T>(x : T) // expected-note {{protocol requires function 'oneArgNoConstraints(x:)' with type... | dataset_sample\swift\apple_swift\test\Constraints\generic_protocol_witness.swift | generic_protocol_witness.swift | Swift | 3,169 | 0.95 | 0.190476 | 0.061224 | awesome-app | 158 | 2025-03-23T02:54:24.838446 | MIT | true | db257d71652319a72f24904c399232a3 |
// RUN: %target-typecheck-verify-swift %s\n\nclass Base<T> { }\nclass Derived: Base<Int> { }\n\nfunc foo<T>(_ x: T) -> Derived where T: Base<Int>, T: Derived {\n return x\n}\n\nfunc bar<T, U>(_ x: U, y: T) -> (Derived, Int) where U: Base<T>, U: Derived {\n// expected-warning@-1 {{same-type requirement makes generic pa... | dataset_sample\swift\apple_swift\test\Constraints\generic_super_constraint.swift | generic_super_constraint.swift | Swift | 682 | 0.95 | 0.142857 | 0.1875 | awesome-app | 169 | 2024-09-27T02:36:36.845479 | BSD-3-Clause | true | d5c313a298493520f3ef8a2b1d90925d |
// RUN: %target-typecheck-verify-swift\n\nenum E {\n case e\n case f\n case g(Int)\n}\n\nfunc testDotSyntax1() -> E {\n if .random() { .e } else { .f }\n}\nfunc testDotSyntax2() -> E? {\n if .random() { .e } else { .f }\n}\nfunc testDotSyntax3() -> E? {\n if .random() { .e } else { .none }\n}\nfunc testDotSyntax4... | dataset_sample\swift\apple_swift\test\Constraints\if_expr.swift | if_expr.swift | Swift | 15,596 | 0.95 | 0.19589 | 0.102134 | node-utils | 401 | 2025-02-07T09:00:21.514156 | MIT | true | 9187415b1ed27b91d5430909651d30d6 |
// RUN: %target-typecheck-verify-swift %clang-importer-sdk\n\n// REQUIRES: objc_interop\n\nimport Foundation\n\nfunc testReturn1(_ d: Double) -> CGFloat {\n if .random() { d } else { 0 }\n}\n\nfunc testReturn2(_ d: Double) -> CGFloat {\n return if .random() { d } else { 0 }\n}\n\nfunc testReturn3(_ d: Double) -> CGFl... | dataset_sample\swift\apple_swift\test\Constraints\if_switch_expr_cgfloat_double_conversion.swift | if_switch_expr_cgfloat_double_conversion.swift | Swift | 922 | 0.95 | 0.212766 | 0.05 | awesome-app | 593 | 2024-09-21T07:50:25.907270 | BSD-3-Clause | true | f105e3d3c149262ef48948d5e4526577 |
// RUN: %target-typecheck-verify-swift %clang-importer-sdk\n// RUN: %target-swift-emit-silgen(mock-sdk: %clang-importer-sdk) -swift-version 5 -verify %s | %FileCheck %s\n\n// REQUIRES: objc_interop\n\nimport Foundation\nimport CoreGraphics\n\nfunc test_to_cgfloat(_: CGFloat) {}\nfunc test_from_cgfloat(_: Double) {}\n\n... | dataset_sample\swift\apple_swift\test\Constraints\implicit_double_cgfloat_conversion.swift | implicit_double_cgfloat_conversion.swift | Swift | 17,358 | 0.95 | 0.019284 | 0.350993 | python-kit | 304 | 2023-10-06T22:07:18.122283 | GPL-3.0 | true | f12bb4b2f8a024a97c53a62ce84d80d6 |
// RUN: %target-typecheck-verify-swift -enable-experimental-feature ImplicitLastExprResults %clang-importer-sdk\n\n// REQUIRES: objc_interop\n// REQUIRES: swift_feature_ImplicitLastExprResults\n\nimport Foundation\n\nfunc testReturn1(_ d: Double) -> CGFloat {\n print("hello")\n d\n}\n\nfunc testReturn2(_ d: Double) -... | dataset_sample\swift\apple_swift\test\Constraints\implicit_last_exprs_double_cgfloat_conversion.swift | implicit_last_exprs_double_cgfloat_conversion.swift | Swift | 1,023 | 0.95 | 0.112903 | 0.054545 | python-kit | 645 | 2025-04-16T04:01:27.003191 | GPL-3.0 | true | 2ec2456ddd77cfee116f481946179b11 |
// RUN: %target-typecheck-verify-swift -import-objc-header %S/Inputs/overload.h\n// REQUIRES: objc_interop\nprotocol rdar29374163Proto {}\n\nclass rdar29374163 {\n init(_ itf: Rdar29374163Itf) { self.itf = itf }\n var itf: Rdar29374163Itf\n func bar() -> Int {\n return itf.foo as! Int\n }\n}\n | dataset_sample\swift\apple_swift\test\Constraints\imported-overload.swift | imported-overload.swift | Swift | 290 | 0.95 | 0.090909 | 0.2 | react-lib | 101 | 2024-06-20T12:52:13.020529 | BSD-3-Clause | true | 40b0989fc3a5e3d1ac0de98e93c8ca45 |
// RUN: %target-swift-frontend %clang-importer-sdk -typecheck %s -verify\n// REQUIRES: objc_interop\n\nimport Foundation\n\nclass RV {\n init() {\n NSPrefixWordBreak2.breakBarBas.rawValue = 0 // expected-error{{cannot assign to property: 'rawValue' is immutable}}\n }\n}\n | dataset_sample\swift\apple_swift\test\Constraints\imported_rawValue_assignment.swift | imported_rawValue_assignment.swift | Swift | 263 | 0.95 | 0.1 | 0.25 | python-kit | 879 | 2024-08-09T17:54:43.984312 | BSD-3-Clause | true | f951ed76dbe15b960ff438e36b35537b |
// RUN: %target-typecheck-verify-swift\n\nstruct MyCollection<Element> { // expected-note {{'Element' declared as parameter to type 'MyCollection'}}\n func map<T>(_ transform: (Element) -> T) -> MyCollection<T> { // expected-note 2 {{in call to function 'map'}}\n fatalError("implement")\n }\n}\n\nMyCollection.map... | dataset_sample\swift\apple_swift\test\Constraints\incomplete_function_ref.swift | incomplete_function_ref.swift | Swift | 647 | 0.95 | 0.071429 | 0.2 | vue-tools | 622 | 2025-05-16T13:52:27.517598 | GPL-3.0 | true | aada0cae0735bbc0ae2158365df92488 |
// RUN: %target-typecheck-verify-swift\n\nprotocol P {}\n\nclass GenericBase<T>: P {}\n\nclass Derived: GenericBase<Int> {}\n\nfunc foo<T: P>(_ x: T) {}\n\nfoo(Derived())\n | dataset_sample\swift\apple_swift\test\Constraints\inherited_generic_conformance.swift | inherited_generic_conformance.swift | Swift | 161 | 0.95 | 0.181818 | 0.166667 | python-kit | 349 | 2025-05-07T14:17:13.605720 | MIT | true | 975fc5a3f161561fd5503ddab5ea1c8d |
// RUN: %target-swift-frontend %s -typecheck -debug-constraints -swift-version 4 2>%t.err\n// RUN: %FileCheck %s < %t.err\n\n// SE-0213. `UInt32(0)` and similar expressions that get transformed into\n// `0 as <#Type#>` should get literal bound early via equality constraint.\n\n// CHECK: ---Constraint solving at [{{.*}}... | dataset_sample\swift\apple_swift\test\Constraints\init_literal_via_coercion.swift | init_literal_via_coercion.swift | Swift | 1,007 | 0.8 | 0 | 0.894737 | python-kit | 500 | 2023-10-28T09:47:15.191216 | GPL-3.0 | true | 397af330c6405a4c975406b8e734378e |
// RUN: %target-typecheck-verify-swift\n\nprotocol Empty {}\n\nprotocol P {\n associatedtype Element\n init()\n}\n\nstruct A<T> : P {\n typealias Element = T\n}\n\nstruct A1<T> : P {\n typealias Element = T\n}\n\nstruct A2<T> : P {\n typealias Element = T\n}\n\nfunc toA<S: Empty, AT:P>(_ s: S) -> AT where AT.Eleme... | dataset_sample\swift\apple_swift\test\Constraints\invalid_archetype_constraint.swift | invalid_archetype_constraint.swift | Swift | 409 | 0.8 | 0 | 0.055556 | react-lib | 564 | 2024-03-25T06:11:30.791793 | GPL-3.0 | true | 80aa2d37d05a4c5fcf2465934b576d2b |
// RUN: %target-typecheck-verify-swift\n\nprotocol P {\n associatedtype A\n func makeIterator() -> Int\n}\nfunc f<U: P>(_ rhs: U) -> X<U.A> { // expected-error {{cannot find type 'X' in scope}}\n let iter = rhs.makeIterator()\n}\n\nstruct Zzz<T> {\n subscript (a: Foo) -> Zzz<T> { // expected-error {{cannot find typ... | dataset_sample\swift\apple_swift\test\Constraints\invalid_constraint_lookup.swift | invalid_constraint_lookup.swift | Swift | 944 | 0.8 | 0.033333 | 0.038462 | awesome-app | 191 | 2024-01-10T17:50:45.586930 | MIT | true | 792ee4693481dea170bcd7caf326b601 |
// RUN: %target-swift-frontend -module-name SomeModule -typecheck -verify -dump-ast -import-objc-header %S/Inputs/imported_type.h %s | %FileCheck %s\n\n// REQUIRES: objc_interop\n\nimport Foundation\n\n// CHECK: declref_expr type="module<SomeModule>"\n// CHECK-NEXT: type_expr type="Data.Type"\nlet type = SomeModule.Dat... | dataset_sample\swift\apple_swift\test\Constraints\invalid_decl_ref.swift | invalid_decl_ref.swift | Swift | 319 | 0.95 | 0 | 0.666667 | vue-tools | 901 | 2024-11-18T02:24:31.997905 | MIT | true | df659f5274c3d3e4fa10ed7c2c48d022 |
// RUN: %target-typecheck-verify-swift\n\nfunc takesAutoclosure<T>(_ lhs: T, _ rhs: @autoclosure () throws -> T) {}\n\nfunc test(\n _ rawPtr: UnsafeRawPointer,\n _ mutRawPtr: UnsafeMutableRawPointer,\n _ mutPtr: UnsafeMutablePointer<Int>,\n _ ptr: UnsafePointer<Int>,\n _ ptrI8: UnsafePointer<Int8>,\n _ ptrU8: Uns... | dataset_sample\swift\apple_swift\test\Constraints\invalid_implicit_conversions.swift | invalid_implicit_conversions.swift | Swift | 3,131 | 0.8 | 0 | 0.030303 | vue-tools | 416 | 2025-01-26T22:58:16.260409 | MIT | true | 33b1a7436ed7c5d05960b0923b829260 |
// RUN: %target-typecheck-verify-swift\n\nclass C {}\nvar c = C()\nif c as C { // expected-error{{cannot convert value of type 'C' to expected condition type 'Bool'}}\n}\n\nif ({1} as () -> Int) { // expected-error{{cannot convert value of type '() -> Int' to expected condition type 'Bool'}}\n}\n | dataset_sample\swift\apple_swift\test\Constraints\invalid_logicvalue_coercion.swift | invalid_logicvalue_coercion.swift | Swift | 288 | 0.95 | 0.333333 | 0.142857 | react-lib | 11 | 2025-01-04T01:54:30.373687 | GPL-3.0 | true | 2d04c32d6bff982515c04f693b9c4e40 |
// RUN: %target-swift-frontend -typecheck -import-objc-header %S/Inputs/invalid_metatype_bridging_header.h %s -verify\n\n// REQUIRES: objc_interop\n\n// rdar://problem/33830526: Constraint system should not add static methods\n// to the overload search space if it would require bridging unrelated metatypes.\nclass Cras... | dataset_sample\swift\apple_swift\test\Constraints\invalid_metatype_bridging_header.swift | invalid_metatype_bridging_header.swift | Swift | 549 | 0.95 | 0.166667 | 0.444444 | awesome-app | 971 | 2024-09-03T12:04:53.118617 | MIT | true | b8bfa5af837afc0c92511da6545439b1 |
// RUN: %target-typecheck-verify-swift -parse-stdlib\n\n// This file is for tests that used to cause the type checker to crash.\n\nclass DictStringInt {\n init(dictionaryLiteral xs: ()...) {} // expected-error{{broken standard library: cannot find Array type}}\n}\n | dataset_sample\swift\apple_swift\test\Constraints\invalid_stdlib.swift | invalid_stdlib.swift | Swift | 259 | 0.95 | 0.285714 | 0.4 | awesome-app | 913 | 2024-03-17T11:09:49.798699 | GPL-3.0 | true | 932d1287641baad02268371057849b19 |
// RUN: %target-typecheck-verify-swift\n\nclass Dictionary<K, V> : ExpressibleByDictionaryLiteral { // expected-error {{type 'Dictionary<K, V>' does not conform to protocol 'ExpressibleByDictionaryLiteral'}} expected-note {{add stubs for conformance}}\n typealias Key = K\n typealias Value = V\n init(dictionaryLiter... | dataset_sample\swift\apple_swift\test\Constraints\invalid_stdlib_2.swift | invalid_stdlib_2.swift | Swift | 519 | 0.95 | 0.153846 | 0.111111 | vue-tools | 595 | 2025-05-10T03:04:52.704372 | BSD-3-Clause | true | 75e9a830cca4cf04ff87e092f59f5621 |
// RUN: %target-swift-emit-silgen %s -verify -module-name M | %FileCheck %s\n\n// https://github.com/apple/swift/issues/45309\n\nfunc f<T>(_: () -> T) {}\nfunc f<T>(_: @autoclosure () -> T) {}\n\n// CHECK: function_ref @$s1M1fyyxyXElF\nf { } // OK\n\nfunc f1<T>(_: () -> T, _: () -> T) {}\nfunc f1<T>(_: @autoclosure () ... | dataset_sample\swift\apple_swift\test\Constraints\issue-45309.swift | issue-45309.swift | Swift | 1,144 | 0.95 | 0 | 0.3 | react-lib | 333 | 2025-02-23T01:17:38.194385 | Apache-2.0 | true | 03ea80a279d51f6442f7b6ee84661d58 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/47241\n\nstruct M<T> where T : Collection { // expected-note {{where 'T' = 'X.Y'}}\n static func f(a: T, b: T) -> [E<T.Iterator.Element>] {\n }\n}\n\nenum E<T> {}\n\nstruct S {}\n\nstruct X {\n struct Y {\n let s: [S]\n }\n\n let... | dataset_sample\swift\apple_swift\test\Constraints\issue-47241.swift | issue-47241.swift | Swift | 452 | 0.95 | 0 | 0.176471 | react-lib | 462 | 2023-09-02T09:56:15.451459 | BSD-3-Clause | true | c0ecada3547f67fc7b667cc10644d8f7 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/47827\n\nprotocol P {}\nclass Helper {}\n\nclass Base {}\nclass Sub<T>: Base {}\n\n// The superclass constraint was the culprit.\nfunc foo<T: Helper & P>(base: Base, arg: T) {\n _ = base as? Sub<T>\n}\n | dataset_sample\swift\apple_swift\test\Constraints\issue-47827.swift | issue-47827.swift | Swift | 274 | 0.95 | 0.214286 | 0.3 | react-lib | 0 | 2025-01-02T22:38:49.179819 | GPL-3.0 | true | 6f234311fad5aaadbf6cc7ebe6b322f7 |
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s\n// REQUIRES: objc_interop\n\n// https://github.com/apple/swift/issues/49646\n\nimport Foundation\n\nclass C : NSObject, NSWobbling {\n func wobble() {}\n func returnMyself() -> Self { return self }\n}\n\nfunc testDynamicOptionalRequirement(_... | dataset_sample\swift\apple_swift\test\Constraints\issue-49646.swift | issue-49646.swift | Swift | 354 | 0.95 | 0.066667 | 0.272727 | python-kit | 690 | 2024-01-08T01:52:58.613671 | GPL-3.0 | true | fd72deec0436a37f0eb78a71b49c83ea |
// RUN: %target-typecheck-verify-swift -swift-version 4\n\n// https://github.com/apple/swift/issues/49968\n\nprotocol X {\n var foo: Int { get }\n var bar: Int { get }\n}\n\nclass Y {\n var foo: Int = 0\n}\nextension Y {\n var bar: Int { return foo }\n}\n\nprotocol Z : Y {\n var foo: Int { get }\n var bar: Int { ... | dataset_sample\swift\apple_swift\test\Constraints\issue-49968.swift | issue-49968.swift | Swift | 1,540 | 0.95 | 0.024691 | 0.045455 | python-kit | 113 | 2023-07-14T15:12:49.306737 | MIT | true | 0dc24042bd461f50dbf046c0c616ec60 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/50410\n\nprotocol Proto {}\nclass Base {}\nclass Test : Base, Proto {}\n\nstruct A {}\nstruct B {}\n\nfunc overloaded<T: Proto & Base>(_ f: () -> T, _ g: (T, A) -> ()) {}\nfunc overloaded<T: Proto & Base>(_ f: () -> T, _ g: (T, B) -> ())... | dataset_sample\swift\apple_swift\test\Constraints\issue-50410.swift | issue-50410.swift | Swift | 472 | 0.95 | 0.090909 | 0.133333 | vue-tools | 136 | 2025-02-26T12:23:38.315717 | GPL-3.0 | true | 5251e2024833040d1196fef0e25a1d0e |
\n// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/50419\n\nfunc f<T>(_ x: T) -> T {\n return x\n}\n\nfunc f<T>(_ x: T?) -> T? {\n return x\n}\n\nlet r = f(1)\nlet _ = r! // expected-error {{cannot force unwrap value of non-optional type 'Int'}}\n\n// https://github.com/apple/swift/i... | dataset_sample\swift\apple_swift\test\Constraints\issue-50419.swift | issue-50419.swift | Swift | 541 | 0.8 | 0 | 0.2 | awesome-app | 526 | 2025-01-18T01:15:24.886442 | GPL-3.0 | true | 088468494fa085f847f61572553d7982 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/51599\n\nfunc test(_ a: [Int], _ f: ((Int) -> Bool)?) {\n _ = a.filter(f!)\n}\n | dataset_sample\swift\apple_swift\test\Constraints\issue-51599.swift | issue-51599.swift | Swift | 156 | 0.8 | 0 | 0.4 | react-lib | 269 | 2025-03-03T18:12:53.095831 | Apache-2.0 | true | 45c6a95f4a03abb13b31be50f57eb058 |
// RUN: %target-swift-frontend -emit-sil -verify -module-name M %s | %FileCheck %s\n\n// https://github.com/apple/swift/issues/52072\n\nclass BaseClass {}\nclass SubClass: BaseClass {}\nstruct Box<T> { init(_: T.Type) {} }\n\n\nfunc test1<T>(box: Box<T>) -> T.Type {\n return T.self\n}\n\nfunc test2<T: BaseClass>(box: ... | dataset_sample\swift\apple_swift\test\Constraints\issue-52072.swift | issue-52072.swift | Swift | 663 | 0.95 | 0.083333 | 0.352941 | react-lib | 177 | 2024-03-02T08:32:02.103482 | MIT | true | 92ebb7f2ca1206b556d41eea7a3d26d4 |
// RUN: %target-swift-frontend -typecheck -verify %s\n\n// REQUIRES: rdar65007946\n\n// https://github.com/apple/swift/issues/52724\n\nstruct A {\n static func * (lhs: A, rhs: A) -> B { return B() }\n static func * (lhs: B, rhs: A) -> B { return B() }\n static func * (lhs: A, rhs: B) -> B { return B() }\n}\nst... | dataset_sample\swift\apple_swift\test\Constraints\issue-52724.swift | issue-52724.swift | Swift | 518 | 0.8 | 0 | 0.235294 | vue-tools | 946 | 2025-05-08T22:37:19.382835 | Apache-2.0 | true | b70f20cb8b5445d841de7cd2259226a5 |
// RUN: %target-swift-frontend -typecheck -verify %s\n\n// https://github.com/apple/swift/issues/52995\n\nprotocol Nested {\n associatedtype U // expected-note {{protocol requires nested type 'U'}}\n}\n\nclass A<M> {\n func f<T : Nested>(_ t: T, _ keyPath: WritableKeyPath<M, T.U>) {}\n}\n\nclass B<Y> : Nested { /... | dataset_sample\swift\apple_swift\test\Constraints\issue-52995.swift | issue-52995.swift | Swift | 738 | 0.95 | 0.227273 | 0.125 | node-utils | 293 | 2025-05-07T03:27:37.233956 | Apache-2.0 | true | 3126f6cbef58a74f21384864084e1b42 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/53125\n\ntypealias T1 = Int\ntypealias T2 = Float\ntypealias T3 = Bool\n\nprotocol P {\n associatedtype R\n static var foo: (T1, (R) -> T2) { get }\n}\n\nextension P {\n static func bind() -> (T1, (R) -> T3) {\n return (1, { _ in t... | dataset_sample\swift\apple_swift\test\Constraints\issue-53125.swift | issue-53125.swift | Swift | 573 | 0.8 | 0 | 0.157895 | react-lib | 145 | 2023-07-30T19:54:38.532312 | BSD-3-Clause | true | 0e9cf1ac80f07ea2942fe58fd03aec84 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/53147\n\nstruct Parser<A> {\n let run: (inout Substring) -> A?\n\n func map<B>(_ f: @escaping (A) -> B) -> Parser<B> {\n return Parser<B> { input in\n self.run(&input).map(f)\n }\n }\n}\n\nlet char = Parser<Character> { str... | dataset_sample\swift\apple_swift\test\Constraints\issue-53147.swift | issue-53147.swift | Swift | 487 | 0.8 | 0 | 0.1 | react-lib | 416 | 2025-04-24T08:47:38.885741 | GPL-3.0 | true | dd0565fc09a75500cfde4862a60d4bac |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/53296\n\nprotocol ViewDataSource: class {\n func foo<T>() -> [T]\n}\n\nclass View {\n weak var delegate: ViewDataSource?\n}\n\nfinal class ViewController<T> {\n let view = View()\n init() {\n view.delegate = self\n // expected-... | dataset_sample\swift\apple_swift\test\Constraints\issue-53296.swift | issue-53296.swift | Swift | 619 | 0.95 | 0.153846 | 0.190476 | react-lib | 887 | 2025-03-04T20:09:12.218219 | Apache-2.0 | true | 600ed3b2fa5556b9f1d95e02c87e8dd1 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/53305\n\nstruct Data {\n init<S: Sequence>(_: S) where S.Element == UInt8 {\n }\n}\n\nclass Consumer {\n static func create(from: Data) -> Data {\n return from\n }\n}\n\nlet _ = Consumer.create(from: Data(\n [0x3E, 0x79, 0x51... | dataset_sample\swift\apple_swift\test\Constraints\issue-53305.swift | issue-53305.swift | Swift | 28,402 | 0.95 | 0.00346 | 0.007018 | vue-tools | 934 | 2024-03-21T19:19:43.132135 | MIT | true | 6608c64c555ec45c528e4af6a3f8c3d2 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/54705\n\nenum Time {\n case milliseconds(Int)\n}\n\nstruct Scheduled<T> {\n let futureResult: EventLoopFuture<T>\n}\n\nstruct EventLoopFuture<T> {\n func flatMap<V>(_ body: @escaping (T) -> EventLoopFuture<V>) -> EventLoopFuture<V> {\... | dataset_sample\swift\apple_swift\test\Constraints\issue-54705.swift | issue-54705.swift | Swift | 1,216 | 0.8 | 0 | 0.081081 | react-lib | 296 | 2025-01-04T02:43:23.724264 | MIT | true | be08daa6f0ff55b1154eb78095764b90 |
// RUN: %target-swift-frontend -typecheck -verify %s\n\n// https://github.com/apple/swift/issues/54799\n\npublic protocol MyProtocol {}\n\npublic struct MyProtocolImpl: MyProtocol {}\n\npublic func != (lhs: MyProtocol, rhs: MyProtocol) -> MyProtocolImpl {\n return MyProtocolImpl()\n}\n\npublic func && (lhs: MyProtocol... | dataset_sample\swift\apple_swift\test\Constraints\issue-54799.swift | issue-54799.swift | Swift | 1,001 | 0.8 | 0.025641 | 0.133333 | awesome-app | 436 | 2025-06-09T19:44:43.446862 | GPL-3.0 | true | ac254bd89fea9cc07ccb22c1e6df5303 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/54820\n\nprotocol Protocol {\n associatedtype Index: Comparable\n subscript(bounds: Range<Index>) -> Int { get }\n // expected-note@+1 {{protocol requires subscript with type '(Wrapper<Base>.Index) -> Int' (aka '(Base.Index) -> Int')}... | dataset_sample\swift\apple_swift\test\Constraints\issue-54820.swift | issue-54820.swift | Swift | 767 | 0.95 | 0.058824 | 0.214286 | node-utils | 536 | 2025-03-26T12:01:13.768922 | Apache-2.0 | true | 5bc4ab9407089c55e11b35ff39d1f0c8 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/54962\n\n@propertyWrapper\n@dynamicMemberLookup\nstruct Binding<Value> {\n var wrappedValue: Value\n\n subscript<Subject>(dynamicMember keyPath: WritableKeyPath<Value, Subject>) -> Binding<Subject> {\n get { fatalError() }\n }\n}\n... | dataset_sample\swift\apple_swift\test\Constraints\issue-54962.swift | issue-54962.swift | Swift | 848 | 0.95 | 0.05 | 0.064516 | react-lib | 982 | 2024-01-16T01:19:42.413337 | MIT | true | dac511d027662d296c26e2c1045386f9 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/55410\n\nprotocol P {}\ntypealias T = (P) -> Void\nlet x: T! = [1, 2, 3].reversed().reduce()\n// expected-error@-1 {{missing arguments for parameters #1, #2 in call}}\n | dataset_sample\swift\apple_swift\test\Constraints\issue-55410.swift | issue-55410.swift | Swift | 243 | 0.8 | 0.125 | 0.5 | awesome-app | 323 | 2024-08-28T00:56:34.002302 | Apache-2.0 | true | af27e3641255adc51c4132f361bc1694 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/55623\n// Make sure we don't incorrectly split the constraint system without\n// considering that a result builder type var may connect the inside of a\n// closure body with the enclosing expression.\n\nstruct New<Value> {\n init(value:... | dataset_sample\swift\apple_swift\test\Constraints\issue-55623.swift | issue-55623.swift | Swift | 811 | 0.8 | 0 | 0.185185 | awesome-app | 612 | 2023-11-24T18:42:46.344532 | GPL-3.0 | true | 49c80ecb8e93a327c79fa0139fc5f341 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/56212\n\nenum E {\ncase foo(String)\n}\n\nstruct Test {\n var bar: E?\n}\n\nstruct S {\n func evaluate(_: Test) -> [Test] {\n return []\n }\n\n func test(set: Set<String>) {\n let flattened = set.flatMap { element in\n ev... | dataset_sample\swift\apple_swift\test\Constraints\issue-56212.swift | issue-56212.swift | Swift | 410 | 0.8 | 0 | 0.105263 | react-lib | 778 | 2024-11-01T16:49:01.828043 | BSD-3-Clause | true | c86751b6dddff612e181a6fe4a4d65cf |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/56348\n\nprotocol TheProtocol {}\nstruct TheType1: TheProtocol {}\n\nenum TheEnum: RawRepresentable {\n typealias RawValue = TheProtocol\n\n case case1\n case case2\n\n init?(rawValue: TheProtocol) {\n self = .case1\n }\n\n var ... | dataset_sample\swift\apple_swift\test\Constraints\issue-56348.swift | issue-56348.swift | Swift | 983 | 0.8 | 0.042553 | 0.055556 | node-utils | 213 | 2025-03-31T11:00:08.944018 | BSD-3-Clause | true | 91ccc1ef238c55beab9e84276a57b861 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/56387\n\nprotocol V {}\n\nprotocol P1 {}\nprotocol P2 {\n func bar() -> V\n}\nprotocol P3 {}\n\nstruct S<T> {\n var foo: T\n}\n\nextension S : P1 {}\nextension S : P2 where T: P3 { // expected-note {{requirement from conditional confor... | dataset_sample\swift\apple_swift\test\Constraints\issue-56387.swift | issue-56387.swift | Swift | 611 | 0.95 | 0 | 0.136364 | vue-tools | 182 | 2024-05-01T01:56:25.995881 | Apache-2.0 | true | 9e16f6caaffea667d93cd17b880152f3 |
// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s\n\n// https://github.com/apple/swift/issues/58019\n\nfunc fetch() {\n // CHECK: open_existential_expr implicit type="Void"\n // CHECK: opaque_value_expr implicit type="any MyError"\n // CHECK-NOT: type="SryMap<$T{{.*}}>.Failure"\n sryMap { return "" }\n .... | dataset_sample\swift\apple_swift\test\Constraints\issue-58019.swift | issue-58019.swift | Swift | 679 | 0.8 | 0 | 0.2 | react-lib | 426 | 2025-04-22T12:14:17.450817 | MIT | true | 720b26c4f04b20c9b1a71c3bf7369a36 |
// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s\n\n// https://github.com/apple/swift/issues/60806\n\nstruct Foo<T> {\n init(_: (T) -> Void) {}\n}\n\nprotocol Bar {}\n\nenum Baz: Bar {\n case someCase(Int)\n}\n\nenum NonBarBaz {\n case someCase(Int)\n}\n\nlet _: Foo<Bar> = Foo<Bar> { (a: Bar) -> Void in\n... | dataset_sample\swift\apple_swift\test\Constraints\issue-60806.swift | issue-60806.swift | Swift | 701 | 0.8 | 0.032258 | 0.2 | python-kit | 88 | 2025-02-19T01:50:44.806527 | Apache-2.0 | true | 0d0e85724ad8f8b57639888a89c502c4 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/60808\n\nprotocol T {}\nstruct A: T {}\n\nfunc test_switch<T>(arr: T) {\n if case _ as A = arr {}\n}\n | dataset_sample\swift\apple_swift\test\Constraints\issue-60808.swift | issue-60808.swift | Swift | 176 | 0.8 | 0.1 | 0.285714 | vue-tools | 902 | 2023-10-11T20:20:43.966596 | GPL-3.0 | true | 95d524ef57dd813722d8485af9187b30 |
// RUN: %target-typecheck-verify-swift\n\nprotocol Wrapper<T> {\n associatedtype T\n\n func get()\n}\n\nfunc foo<R>(_: R) -> any Wrapper<R> {}\n\nfunc test() {\n foo(0).get()\n}\n | dataset_sample\swift\apple_swift\test\Constraints\issue-64621.swift | issue-64621.swift | Swift | 169 | 0.8 | 0 | 0.111111 | python-kit | 736 | 2024-12-23T11:55:48.050617 | GPL-3.0 | true | a110e9e7c0f737df0c7e444cfe8403be |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/66553\n\nfunc baz(y: [Int], z: Int) -> Int {\n switch z {\n case y[let z]: // expected-error {{'let' binding pattern cannot appear in an expression}}\n z\n default:\n z\n }\n}\n | dataset_sample\swift\apple_swift\test\Constraints\issue-66553.swift | issue-66553.swift | Swift | 258 | 0.8 | 0.083333 | 0.2 | python-kit | 995 | 2023-12-04T16:45:05.025356 | Apache-2.0 | true | 7c73b1c88f460df6bf7c5181d17d2f17 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/66561\n\n@propertyWrapper\nstruct WrapperValue<Value> {\n var value: Value\n init(wrappedValue: Value) {\n self.value = wrappedValue\n }\n\n var projectedValue: Self {\n return self\n }\n\n var wrappedValue: Value {\n get ... | dataset_sample\swift\apple_swift\test\Constraints\issue-66561.swift | issue-66561.swift | Swift | 546 | 0.8 | 0.027778 | 0.064516 | awesome-app | 203 | 2024-10-30T19:37:28.475889 | Apache-2.0 | true | cc98cc508cd7ceb83c77a39fd2321fe5 |
// RUN: %target-typecheck-verify-swift -target %target-swift-5.9-abi-triple\n\nstruct G<each T>: Sequence {\n typealias Element = Int\n typealias Iterator = [Int].Iterator\n\n consuming func makeIterator() -> Iterator {\n fatalError()\n }\n}\n\n// expected-note@+1 {{in call to function 'foo'}}\nfunc foo<each T>(... | dataset_sample\swift\apple_swift\test\Constraints\issue-67906.swift | issue-67906.swift | Swift | 603 | 0.95 | 0.16 | 0.2 | awesome-app | 456 | 2024-03-06T01:04:33.140229 | GPL-3.0 | true | 8c7cd6df730ddf8a6e2113df9cbb07da |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/71040\n\n@resultBuilder\nstruct Builder {\n static func buildBlock<T>(_ components: T...) -> T {\n components.first!\n }\n}\n\nstruct S<T> {\n init(_ fn: () -> T) {}\n}\n\nfunc foo<T>(@Builder _ fn: () -> T) {}\n\n@Builder\nfunc ba... | dataset_sample\swift\apple_swift\test\Constraints\issue-71040.swift | issue-71040.swift | Swift | 400 | 0.8 | 0.038462 | 0.095238 | python-kit | 247 | 2024-05-17T09:02:42.780502 | BSD-3-Clause | true | f37a09e6516063384da0f6098dbbe62b |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/71273\n\nfunc bar<R>(_ fn: () -> R) {}\n\n// Make sure we don't error here.\nfunc testLocalFn() {\n bar() {\n func foo() -> Int { return 0 }\n return ()\n }\n}\n\nfunc testLocalBinding() {\n bar() {\n let _ = if .random() { r... | dataset_sample\swift\apple_swift\test\Constraints\issue-71273.swift | issue-71273.swift | Swift | 438 | 0.8 | 0.095238 | 0.235294 | react-lib | 550 | 2024-04-19T14:36:46.258630 | BSD-3-Clause | true | acc2471c02bb9b6cd6d1d9972284cd77 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/apple/swift/issues/71282\n\nenum E {\n case e\n}\n\n// Make sure we don't crash.\nfunc foo(_ x: E) {\n return if .random() {\n ()\n switch x {\n case .e:\n ()\n }\n } else { // expected-error {{non-expression branch of 'if' expression m... | dataset_sample\swift\apple_swift\test\Constraints\issue-71282.swift | issue-71282.swift | Swift | 346 | 0.8 | 0.15 | 0.176471 | react-lib | 125 | 2023-09-12T05:30:43.387798 | BSD-3-Clause | true | cdffa1fc8e9ec4709d002271d715420f |
// RUN: not %target-swift-frontend -typecheck %s\n\n// Just don't crash.\n\nBinding<Bool>Binding<Bool>\n | dataset_sample\swift\apple_swift\test\Constraints\issue-77008.swift | issue-77008.swift | Swift | 99 | 0.6 | 0 | 0.666667 | node-utils | 496 | 2024-02-27T20:15:07.470702 | MIT | true | 951db2a9bf742752f6995948e9c07c7b |
// RUN: %target-typecheck-verify-swift\n\nfunc foo<T>(_: () -> (Optional<T>, Int)) -> T { fatalError() }\n\nlet x: Int = foo { () -> (Optional, Int) in fatalError() }\n | dataset_sample\swift\apple_swift\test\Constraints\issue-77315.swift | issue-77315.swift | Swift | 163 | 0.8 | 0 | 0.333333 | awesome-app | 656 | 2025-01-08T07:19:47.290473 | Apache-2.0 | true | 3227d3e38c420e25b93dd53b8a1b3bb0 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/swiftlang/swift/issues/77393\n// Make sure we don't crash.\n\n@freestanding(expression)\nmacro someMacro() = #externalMacro(module: "", type: "")\n// expected-warning@-1 {{external macro implementation type '.' could not be found for macro 'someMacro()'; p... | dataset_sample\swift\apple_swift\test\Constraints\issue-77393.swift | issue-77393.swift | Swift | 1,180 | 0.95 | 0.25 | 0.722222 | python-kit | 875 | 2025-03-19T02:13:12.530913 | BSD-3-Clause | true | 005d7d5102449fecfa8c8914ba8178a0 |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/swiftlang/swift/issues/77924\nfunc foo<T>(_ x: (T) -> Void) {\n (a: 0, b: x).b(0) // expected-error {{cannot convert value of type 'Int' to expected argument type 'T'}}\n}\n\nfunc bar<T>(_ x: T) {} // expected-note {{generic parameters are always consider... | dataset_sample\swift\apple_swift\test\Constraints\issue-77924.swift | issue-77924.swift | Swift | 494 | 0.8 | 0 | 0.222222 | awesome-app | 61 | 2024-12-17T07:57:23.594579 | Apache-2.0 | true | 62de23e5f26bdd84f0f69523de546f20 |
// RUN: %target-typecheck-verify-swift %clang-importer-sdk\n\n// REQUIRES: objc_interop\n\nimport Foundation\nimport CoreGraphics\n\nfunc foo(_ x: Double) {}\nfunc bar() -> Double { 0 }\n\n// https://github.com/swiftlang/swift/issues/78376\nlet _: (CGFloat) -> Void = foo\n// expected-error@-1 {{cannot convert value of ... | dataset_sample\swift\apple_swift\test\Constraints\issue-78376.swift | issue-78376.swift | Swift | 500 | 0.95 | 0 | 0.454545 | python-kit | 533 | 2024-01-01T23:17:41.669563 | MIT | true | 7388bd31ce9921004f1b7631623ccafd |
// RUN: %target-typecheck-verify-swift\n\n// https://github.com/swiftlang/swift/issues/79444\nclass C {\n func foo() {\n _ = { [x = "\(self)"] in } // expected-warning {{capture 'x' was never used}}\n _ = { [x = "\(self)"] in x }\n _ = { [x = "\(self)"] in \n let y = x\n return y \n }\n _ = { ... | dataset_sample\swift\apple_swift\test\Constraints\issue-79444.swift | issue-79444.swift | Swift | 436 | 0.95 | 0.05 | 0.105263 | vue-tools | 740 | 2024-12-28T05:09:46.829906 | MIT | true | f7ee64f0e5e1a618cf6d8f93b24c775d |
// RUN: %target-typecheck-verify-swift\n\nfunc basic() {\n var i: Int! = 0\n let _: Int = i\n i = 7\n}\n\nfunc takesIUOs(i: Int!, j: inout Int!) -> Int {\n j = 7\n return i\n}\n\nstruct S {\n let i: Int!\n var j: Int!\n let k: Int\n var m: Int\n var n: Int! {\n get {\n return m\n }\n set {\n ... | dataset_sample\swift\apple_swift\test\Constraints\iuo.swift | iuo.swift | Swift | 5,737 | 0.95 | 0.052419 | 0.069652 | awesome-app | 62 | 2024-09-28T11:25:21.920757 | Apache-2.0 | true | 0a82f8eb8f11e175ec7afe2800f96ef9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.