Files
swift-mirror/test/SILGen/magic_identifier_filepath.swift
Robert Widmann 6ffd6f5f8f [NFC] Strip Unnecessary %s's out of Tests
%target-typecheck-verify-swift already implies the current file being passed to the frontend - these just lead to duplicate input file errors.
2021-09-20 11:50:37 -07:00

31 lines
1.2 KiB
Swift

// Check that we generate the right strings.
// RUN: %target-swift-emit-silgen -module-name Foo %/s | %FileCheck %s
// Even if concise #file is not available, we now allow you to write #filePath.
// Check that we don't diagnose any errors in this file.
// RUN: %target-typecheck-verify-swift -module-name Foo
// #filePath should appear in swiftinterfaces with this change.
// RUN: %target-swift-frontend-typecheck -module-name Foo -emit-module-interface-path %t.swiftinterface %s
// RUN: %FileCheck -check-prefix SWIFTINTERFACE %s < %t.swiftinterface
// FIXME: Once this feature has been fully staged in, we should duplicate
// existing #file tests and delete this file.
func directUse() {
print(#filePath)
// CHECK-LABEL: sil {{.*}} @$s3Foo9directUseyyF
// CHECK: string_literal utf8 "SOURCE_DIR/test/SILGen/magic_identifier_filepath.swift"
}
func indirectUse() {
functionWithFilePathDefaultArgument()
// CHECK-LABEL: sil {{.*}} @$s3Foo11indirectUseyyF
// CHECK: string_literal utf8 "SOURCE_DIR/test/SILGen/magic_identifier_filepath.swift"
}
public func functionWithFilePathDefaultArgument(file: String = #filePath) {}
// SWIFTINTERFACE: public func functionWithFilePathDefaultArgument(file: Swift.String = #filePath)