-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added unimplemented expression cases in the ASTPrinter #64667
Conversation
@hamishknight I have implemented one of the functions for you to review if I have done it the right way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on!
7673bfa
to
8231914
Compare
8231914
to
58e0722
Compare
58e0722
to
ca14635
Compare
How would |
ca14635
to
b15b531
Compare
Sorry, I shouldn't have included
|
Alright! If I correctly understand, the capture in Also after the recent update in Swift, I presume we no longer have to use |
Yes they are similar to lambda captures (specifically captures by value). class C {}
var c = C()
let fn = { [weak c] in } And without them, the capture is by a strong reference: class C {}
var c = C()
let fn = { [c] in } |
b15b531
to
1b5c7cf
Compare
6bb3422
to
8da1c75
Compare
Note you will also need to fixup // CHECK: internal func cast(_ a: Any) {
- // CHECK: @_hasInitialValue private let conditional: (any Archivable)? = a as? any Archivable
- // CHECK: @_hasInitialValue private let forced: any Archivable = a as! any Archivable
+ // CHECK: @_hasInitialValue let conditional: (any Archivable)? = a as? any Archivable
+ // CHECK: @_hasInitialValue let forced: any Archivable = a as! any Archivable
// CHECK: } |
|
See #64667 (comment), the components still need printing |
Under |
The individual components are good, but you're not calling into |
IIUC, we need to call this irrespective of any of the conditions (like ObjC or if root exists or not)? |
Yes, that's correct. FWIW it looks like the |
d494003
to
135333f
Compare
@swift-ci please test |
135333f
to
dac72b2
Compare
Tests pass locally, I have pushed again, maybe a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you need to make a couple of other changes (the change to not print access modifiers for local declarations has affected a couple of other tests):
In test/attr/accessibility_print.swift
:
@@ -211,14 +211,14 @@ public extension FE_PublicClass {
// CHECK-LABEL: internal func GA_localTypes()
func GA_localTypes() {
- // CHECK-SRC: private struct Local {
+ // CHECK-SRC: struct Local {
struct Local {
// CHECK-SRC: internal let x
let x = 0
}
_ = Local()
- // CHECK-SRC: private enum LocalEnum {
+ // CHECK-SRC: enum LocalEnum {
enum LocalEnum {
// CHECK-SRC: {{^}} case A
case A, B
In decl/enum/derived_hashable_equatable.swift
:
@@ -8,14 +8,14 @@ enum Simple: Hashable {
case b
// CHECK: @_implements(Equatable, ==(_:_:)) internal static func __derived_enum_equals(_ a: Simple, _ b: Simple) -> Bool {
- // CHECK-NEXT: private var index_a: Int
+ // CHECK-NEXT: var index_a: Int
// CHECK-NEXT: switch a {
// CHECK-NEXT: case .a:
// CHECK-NEXT: index_a = 0
// CHECK-NEXT: case .b:
// CHECK-NEXT: index_a = 1
// CHECK-NEXT: }
- // CHECK-NEXT: private var index_b: Int
+ // CHECK-NEXT: var index_b: Int
// CHECK-NEXT: switch b {
// CHECK-NEXT: case .a:
// CHECK-NEXT: index_b = 0
@@ -26,7 +26,7 @@ enum Simple: Hashable {
// CHECK-NEXT: }
// CHECK: internal func hash(into hasher: inout Hasher) {
- // CHECK-NEXT: private var discriminator: Int
+ // CHECK-NEXT: var discriminator: Int
// CHECK-NEXT: switch self {
// CHECK-NEXT: case .a:
// CHECK-NEXT: discriminator = 0
@@ -101,14 +101,14 @@ enum HasUnavailableElement: Hashable {
case b
// CHECK: @_implements(Equatable, ==(_:_:)) internal static func __derived_enum_equals(_ a: HasUnavailableElement, _ b: HasUnavailableElement) -> Bool {
- // CHECK-NEXT: private var index_a: Int
+ // CHECK-NEXT: var index_a: Int
// CHECK-NEXT: switch a {
// CHECK-NEXT: case .a:
// CHECK-NEXT: index_a = 0
// CHECK-NEXT: case .b:
// CHECK-NEXT: _diagnoseUnavailableCodeReached{{.*}}()
// CHECK-NEXT: }
- // CHECK-NEXT: private var index_b: Int
+ // CHECK-NEXT: var index_b: Int
// CHECK-NEXT: switch b {
// CHECK-NEXT: case .a:
// CHECK-NEXT: index_b = 0
@@ -119,7 +119,7 @@ enum HasUnavailableElement: Hashable {
// CHECK-NEXT: }
// CHECK: internal func hash(into hasher: inout Hasher) {
- // CHECK-NEXT: private var discriminator: Int
+ // CHECK-NEXT: var discriminator: Int
// CHECK-NEXT: switch self {
// CHECK-NEXT: case .a:
// CHECK-NEXT: discriminator = 0
@@ -185,14 +185,14 @@ enum UnavailableEnum: Hashable {
case b
// CHECK: @_implements(Equatable, ==(_:_:)) internal static func __derived_enum_equals(_ a: UnavailableEnum, _ b: UnavailableEnum) -> Bool {
- // CHECK-NEXT: private var index_a: Int
+ // CHECK-NEXT: var index_a: Int
// CHECK-NEXT: switch a {
// CHECK-NEXT: case .a:
// CHECK-NEXT: index_a = 0
// CHECK-NEXT: case .b:
// CHECK-NEXT: index_a = 1
// CHECK-NEXT: }
- // CHECK-NEXT: private var index_b: Int
+ // CHECK-NEXT: var index_b: Int
// CHECK-NEXT: switch b {
// CHECK-NEXT: case .a:
// CHECK-NEXT: index_b = 0
@@ -203,7 +203,7 @@ enum UnavailableEnum: Hashable {
// CHECK-NEXT: }
// CHECK: internal func hash(into hasher: inout Hasher) {
- // CHECK-NEXT: private var discriminator: Int
+ // CHECK-NEXT: var discriminator: Int
// CHECK-NEXT: switch self {
// CHECK-NEXT: case .a:
// CHECK-NEXT: discriminator = 0
dac72b2
to
ffc7673
Compare
@swift-ci please test |
Regressions macOS Platform:
|
@swift-ci please test macOS |
Looks like a couple more test tweaks are needed:
@@ -25,7 +25,7 @@ enum HasElementsWithAvailability: Hashable {
case introduced10_50
// CHECK: @_implements(Equatable, ==(_:_:)) internal static func __derived_enum_equals(_ a: HasElementsWithAvailability, _ b: HasElementsWithAvailability) -> Bool {
- // CHECK-NEXT: private var index_a: Int
+ // CHECK-NEXT: var index_a: Int
// CHECK-NEXT: switch a {
// CHECK-NEXT: case .alwaysAvailable:
// CHECK-NEXT: index_a = 0
@@ -40,7 +40,7 @@ enum HasElementsWithAvailability: Hashable {
// CHECK-NEXT: case .introduced10_50:
// CHECK-NEXT: index_a = 2
// CHECK-NEXT: }
- // CHECK-NEXT: private var index_b: Int
+ // CHECK-NEXT: var index_b: Int
// CHECK-NEXT: switch b {
// CHECK-NEXT: case .alwaysAvailable:
// CHECK-NEXT: index_b = 0
@@ -59,7 +59,7 @@ enum HasElementsWithAvailability: Hashable {
// CHECK-NEXT: }
// CHECK: internal func hash(into hasher: inout Hasher) {
- // CHECK-NEXT: private var discriminator: Int
+ // CHECK-NEXT: var discriminator: Int
// CHECK-NEXT: switch self {
// CHECK-NEXT: case .alwaysAvailable:
// CHECK-NEXT: discriminator = 0
@@ -1,4 +1,4 @@
-// RUN: %target-swift-frontend -print-ast %s 2>&1 | %FileCheck %s
+// RUN: %target-swift-frontend -print-ast -disable-availability-checking %s 2>&1 | %FileCheck %s
func fetch() async throws -> String {
} |
ffc7673
to
48847da
Compare
@swift-ci please test |
CI looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Welcome! |
Part of #61601
Filled out the remaining expression cases for ASTPrinter, which were left out after in the PR #40691.