fix missing effects specifiers on eff props in swiftinterface

I missed the case where the body is also being printed in the
interface file.
This commit is contained in:
Kavon Farvardin
2021-04-29 17:36:38 -07:00
parent c236f85039
commit c1f48c6855
2 changed files with 38 additions and 0 deletions

View File

@@ -3490,6 +3490,10 @@ void PrintAST::visitAccessorDecl(AccessorDecl *decl) {
}); });
} }
// handle effects specifiers before the body
if (decl->hasAsync()) Printer << " async";
if (decl->hasThrows()) Printer << " throws";
printBodyIfNecessary(decl); printBodyIfNecessary(decl);
} }

View File

@@ -0,0 +1,34 @@
// RUN: %target-swift-frontend -enable-experimental-concurrency -typecheck -swift-version 5 -enable-library-evolution -emit-module-interface-path %t.swiftinterface %s -module-name EffProps
// RUN: %FileCheck %s < %t.swiftinterface
public struct MyStruct {}
// CHECK-LABEL: public var status
// CHECK: get async throws
public extension MyStruct {
struct InnerStruct {
public var status: Bool { get async throws { false } }
}
}
// CHECK-LABEL: public var hello
// CHECK: get async
// CHECK-LABEL: public subscript
// CHECK: get async throws
public class C {
public var hello: Int { get async { 0 } }
public subscript(_ x: Int) -> Void {
get async throws { }
}
}
// CHECK-LABEL: public var world
// CHECK: get throws
public enum E {
public var world: Int { get throws { 0 } }
}