Skip to content

Commit

Permalink
Swift: upgrade to 5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Denisov committed Sep 19, 2023
1 parent 9b35202 commit 1bd3b91
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getNumberOfMembers: | 0 | getInterfaceType: | module<Foo> | getName: | Foo | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 4 | getNumberOfExportedModules: | 1 |
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getNumberOfMembers: | 0 | getInterfaceType: | module<Foo> | getName: | Foo | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 5 | getNumberOfExportedModules: | 1 |
| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getNumberOfMembers: | 0 | getInterfaceType: | module<__ObjC> | getName: | __ObjC | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 1 | getNumberOfExportedModules: | 0 |
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getNumberOfMembers: | 0 | getInterfaceType: | module<default_module_name> | getName: | default_module_name | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 4 | getNumberOfExportedModules: | 0 |
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getNumberOfMembers: | 0 | getInterfaceType: | module<default_module_name> | getName: | default_module_name | getNumberOfInheritedTypes: | 0 | isBuiltinModule: | no | isSystemModule: | no | getNumberOfImportedModules: | 5 | getNumberOfExportedModules: | 0 |
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
| file://:0:0:0:0 | Foo | file://:0:0:0:0 | SwiftOnoneSupport |
| file://:0:0:0:0 | Foo | file://:0:0:0:0 | _Concurrency |
| file://:0:0:0:0 | Foo | file://:0:0:0:0 | _StringProcessing |
| file://:0:0:0:0 | Foo | file://:0:0:0:0 | _SwiftConcurrencyShims |
| file://:0:0:0:0 | __ObjC | file://:0:0:0:0 | Swift |
| file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | Swift |
| file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | SwiftOnoneSupport |
| file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | _Concurrency |
| file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | _StringProcessing |
| file://:0:0:0:0 | default_module_name | file://:0:0:0:0 | _SwiftConcurrencyShims |
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
| method_lookups.swift:44:11:44:13 | .foo(_:_:) | method_lookups.swift:12:3:12:35 | foo(_:_:) |
| method_lookups.swift:47:1:47:1 | Task<Success, Never>.init(priority:operation:) | file://:0:0:0:0 | Task<Success, Never>.init(priority:operation:) |
| method_lookups.swift:48:9:48:11 | .foo(_:_:) | method_lookups.swift:22:3:22:35 | foo(_:_:) |
| method_lookups.swift:49:9:49:11 | .bar() | method_lookups.swift:23:3:23:21 | bar() |
| method_lookups.swift:49:9:49:11 | .bar() | method_lookups.swift:23:15:23:33 | bar() |
| method_lookups.swift:50:9:50:9 | Z.init() | method_lookups.swift:26:3:28:3 | Z.init() |
| method_lookups.swift:50:9:50:13 | .baz(_:) | method_lookups.swift:24:3:24:21 | baz(_:) |
| method_lookups.swift:52:11:52:13 | .bar() | method_lookups.swift:23:3:23:21 | bar() |
| method_lookups.swift:52:11:52:13 | .bar() | method_lookups.swift:23:15:23:33 | bar() |
| method_lookups.swift:53:18:53:18 | Z.init() | method_lookups.swift:26:3:28:3 | Z.init() |
| method_lookups.swift:53:23:53:23 | .baz(_:) | method_lookups.swift:24:3:24:21 | baz(_:) |
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| method_lookups.swift:44:11:44:13 | .foo(_:_:) | (Int, Int) -> () |
| method_lookups.swift:47:1:47:1 | Task<Success, Never>.init(priority:operation:) | (TaskPriority?, __owned @escaping @Sendable () async -> ()) -> Task<(), Never> |
| method_lookups.swift:48:9:48:11 | .foo(_:_:) | @MainActor (Int, Int) -> () |
| method_lookups.swift:49:9:49:11 | .bar() | @MainActor () -> () |
| method_lookups.swift:49:9:49:11 | .bar() | () -> () |
| method_lookups.swift:50:9:50:9 | Z.init() | @MainActor () -> Z |
| method_lookups.swift:50:9:50:13 | .baz(_:) | @MainActor (Int) -> () |
| method_lookups.swift:52:11:52:13 | .bar() | () -> () |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ actor Y {
@MainActor
class Z {
static func foo(_: Int, _:Int) {}
class func bar() {}
nonisolated class func bar() {}
func baz(_: Int) {}

init() {
Expand Down
74 changes: 36 additions & 38 deletions swift/ql/test/library-tests/ast/PrintAst.expected
Original file line number Diff line number Diff line change
Expand Up @@ -3237,44 +3237,42 @@ cfg.swift:
# 524| getParam(0): [ParamDecl] continuation
# 524| Type = AsyncStream<Int>.Continuation
# 523| getBody(): [BraceStmt] { ... }
# 525| getElement(0): [BraceStmt] { ... }
# 525| getElement(0): [CallExpr] call to detached(priority:operation:)
# 525| getFunction(): [MethodLookupExpr] .detached(priority:operation:)
# 525| getBase(): [TypeExpr] Task<(), Never>.Type
# 525| getTypeRepr(): [TypeRepr] Task<(), Never>
# 525| getMethodRef(): [DeclRefExpr] detached(priority:operation:)
# 525| getArgument(0): [Argument] priority: default priority
# 525| getExpr(): [DefaultArgumentExpr] default priority
# 525| getArgument(1): [Argument] operation: { ... }
# 525| getExpr(): [ExplicitClosureExpr] { ... }
# 525| getBody(): [BraceStmt] { ... }
# 526| getElement(0): [ForEachStmt] for ... in ... { ... }
# 526| getPattern(): [NamedPattern] i
# 526| getSequence(): [CallExpr] call to makeIterator()
# 526| getFunction(): [MethodLookupExpr] .makeIterator()
# 526| getBase(): [BinaryExpr] ... ....(_:_:) ...
# 526| getFunction(): [MethodLookupExpr] ....(_:_:)
# 526| getBase(): [TypeExpr] Int.Type
# 526| getTypeRepr(): [TypeRepr] Int
# 526| getMethodRef(): [DeclRefExpr] ...(_:_:)
# 526| getArgument(0): [Argument] : 1
# 526| getExpr(): [IntegerLiteralExpr] 1
# 526| getArgument(1): [Argument] : 100
# 526| getExpr(): [IntegerLiteralExpr] 100
#-----| getMethodRef(): [DeclRefExpr] makeIterator()
# 526| getBody(): [BraceStmt] { ... }
# 527| getElement(0): [CallExpr] call to yield(_:)
# 527| getFunction(): [MethodLookupExpr] .yield(_:)
# 527| getBase(): [DeclRefExpr] continuation
# 527| getMethodRef(): [DeclRefExpr] yield(_:)
# 527| getArgument(0): [Argument] : i
# 527| getExpr(): [DeclRefExpr] i
# 529| getElement(1): [CallExpr] call to finish()
# 529| getFunction(): [MethodLookupExpr] .finish()
# 529| getBase(): [DeclRefExpr] continuation
# 529| getMethodRef(): [DeclRefExpr] finish()
# 527| getCapture(0): [CapturedDecl] continuation
# 525| getElement(1): [ReturnStmt] return
# 525| getElement(0): [CallExpr] call to detached(priority:operation:)
# 525| getFunction(): [MethodLookupExpr] .detached(priority:operation:)
# 525| getBase(): [TypeExpr] Task<(), Never>.Type
# 525| getTypeRepr(): [TypeRepr] Task<(), Never>
# 525| getMethodRef(): [DeclRefExpr] detached(priority:operation:)
# 525| getArgument(0): [Argument] priority: default priority
# 525| getExpr(): [DefaultArgumentExpr] default priority
# 525| getArgument(1): [Argument] operation: { ... }
# 525| getExpr(): [ExplicitClosureExpr] { ... }
# 525| getBody(): [BraceStmt] { ... }
# 526| getElement(0): [ForEachStmt] for ... in ... { ... }
# 526| getPattern(): [NamedPattern] i
# 526| getSequence(): [CallExpr] call to makeIterator()
# 526| getFunction(): [MethodLookupExpr] .makeIterator()
# 526| getBase(): [BinaryExpr] ... ....(_:_:) ...
# 526| getFunction(): [MethodLookupExpr] ....(_:_:)
# 526| getBase(): [TypeExpr] Int.Type
# 526| getTypeRepr(): [TypeRepr] Int
# 526| getMethodRef(): [DeclRefExpr] ...(_:_:)
# 526| getArgument(0): [Argument] : 1
# 526| getExpr(): [IntegerLiteralExpr] 1
# 526| getArgument(1): [Argument] : 100
# 526| getExpr(): [IntegerLiteralExpr] 100
#-----| getMethodRef(): [DeclRefExpr] makeIterator()
# 526| getBody(): [BraceStmt] { ... }
# 527| getElement(0): [CallExpr] call to yield(_:)
# 527| getFunction(): [MethodLookupExpr] .yield(_:)
# 527| getBase(): [DeclRefExpr] continuation
# 527| getMethodRef(): [DeclRefExpr] yield(_:)
# 527| getArgument(0): [Argument] : i
# 527| getExpr(): [DeclRefExpr] i
# 529| getElement(1): [CallExpr] call to finish()
# 529| getFunction(): [MethodLookupExpr] .finish()
# 529| getBase(): [DeclRefExpr] continuation
# 529| getMethodRef(): [DeclRefExpr] finish()
# 527| getCapture(0): [CapturedDecl] continuation
# 523| getPattern(0): [NamedPattern] stream
# 533| getElement(1): [ForEachStmt] for ... in ... { ... }
# 533| getPattern(): [NamedPattern] i
Expand Down
5 changes: 1 addition & 4 deletions swift/ql/test/library-tests/controlflow/graph/Cfg.expected
Original file line number Diff line number Diff line change
Expand Up @@ -6063,14 +6063,11 @@ cfg.swift:
# 525| Task<(), Never>.Type
#-----| -> default priority

# 525| return
#-----| return -> exit { ... } (normal)

# 525| .detached(priority:operation:)
#-----| -> Task<(), Never>.Type

# 525| call to detached(priority:operation:)
#-----| -> return
#-----| -> exit { ... } (normal)

# 525| default priority
#-----| -> { ... }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ methodlookup.swift:
# 47| getFunction(): [MethodLookupExpr] .instanceMethod()
# 47| getBase(): [DeclRefExpr] baz
# 47| getMethodRef(): [DeclRefExpr] instanceMethod()
# 47| getMethodRef().getFullyConverted(): [FunctionConversionExpr] ((Baz) -> @MainActor () -> ()) ...
# 47| getElement(2).getFullyConverted(): [AwaitExpr] await ...
# 48| getElement(3): [CallExpr] call to { ... }
# 48| getFunction(): [CallExpr] call to Baz.instanceMethod()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ actor Bar {
@MainActor
class Baz {
init() {}
func instanceMethod() {}
nonisolated func instanceMethod() {}
static func staticMethod() {}
class func classMethod() {}
}
Expand Down
12 changes: 4 additions & 8 deletions swift/third_party/load.bzl
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

# TODO: remove `remove-result-of.patch` once we update to a Swift version containing
# https://github.com/apple/swift/commit/2ed2cea2
# (probably when updating to 5.9)
_swift_prebuilt_version = "swift-5.8.1-RELEASE.214"
_swift_prebuilt_version = "swift-5.9-RELEASE.226"
_swift_sha_map = {
"Linux-X64": "009594131d2f6327e0033c4b7b0479a5730427575eb59a81a439fe0e343aa777",
"macOS-ARM64": "304a918e3699d404f57e967eff79b982388d8c5330c2135272c9f3a825920a39",
"macOS-X64": "c763c493e5782869b54887dc72df2aad00d59af7272c6d96377f1debb98741f2",
"Linux-X64": "674b8da9d8c7cc585055b1821076510553a9df340ef931aa45cbe00eb0f7f86e",
"macOS-ARM64": "a4c2486d0532e43f0b7c55d1203e17672900541c72fd3fcb8d9ffdef3698dc6f",
"macOS-X64": "b84ba67f9024ff9ce43879eb6503efd2f9952ac85ab2c2fb8d2f01d0af432ac9",
}

_swift_arch_map = {
Expand Down Expand Up @@ -46,7 +43,6 @@ def load_dependencies(workspace_name):
patches = [
"@%s//swift/third_party/swift-llvm-support:patches/%s.patch" % (workspace_name, patch_name)
for patch_name in (
"remove-result-of",
"remove-redundant-operators",
"add-constructor-to-Compilation",
)
Expand Down

This file was deleted.

0 comments on commit 1bd3b91

Please sign in to comment.