Files
swift-mirror/test/ModuleInterface/closure.swift
Alex Hoppen 66e416b604 [AST] Don’t print internal function labels if they start with '$'
We might infer internal function labels as `$0` from a closure with which a variable is initialised. But we don’t want to print the function signature as `(_ $0: Int) -> Int` because `$0` is not a valid variable name to declare.

So, in the case described above, only print the type.

Fixes rdar://77462547
2021-05-04 12:42:58 +02:00

13 lines
450 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck %s -emit-module-interface-path %t/main.swiftinterface -enable-library-evolution
// RUN: %FileCheck %s < %t/main.swiftinterface
// CHECK: import Swift
// CHECK: public let MyClosureVar: (Swift.Int) -> Swift.Int
public let MyClosureVar: (Int) -> Int = { $0 }
// CHECK: public var MyOtherClosureVar: (_ x: Swift.Int) -> Swift.Int
public let MyOtherClosureVar: (_ x: Int) -> Int