Files
swift-mirror/test/ModuleInterface/ConstKeyword.swift
Xi Ge 06e63896cd ModuleInterface: consume _const keyword at var and parameter decls and keep them in textual/binary modules
This is to ensure users can start adding these annotations. Type checker supports will come in later commits.

Related to pitch: https://forums.swift.org/t/pitch-compile-time-constant-values/53606

rdar://85268028
2021-11-19 22:13:23 -08:00

20 lines
788 B
Swift

// RUN: %empty-directory(%t)
// Ensure the attribute is printed in swiftinterface files
// RUN: %target-swift-frontend-typecheck -emit-module-interface-path %t/Foo.swiftinterface %s -module-name Foo
// RUN: %FileCheck %s < %t/Foo.swiftinterface
// Ensure the attribute is in .swiftmodule files
// RUN: %target-swift-ide-test -print-module -module-to-print Foo -I %t -source-filename %s -fully-qualified-types -print-access > %t/printed-module.txt
// RUN: %FileCheck %s < %t/printed-module.txt
public struct A {
public _const let A = "value"
public func takeConst1(a: _const Int) {}
public func takeConst2(a b: _const Int) {}
}
// CHECK: _const public let A: Swift.String
// CHECK: public func takeConst1(a: _const Swift.Int)
// CHECK: public func takeConst2(a b: _const Swift.Int)