Hello! I’m trying to test which ParameterTypeFlags flag combinations are valid. I wrote the following test case. Are the results “as expected”, or are some of the failures incorrect?
// RUN: %target-typecheck-verify-swift // // isVariadic is NOT compatible with any flag combinations // // expected-error@+1 {{@autoclosure must not be used on variadic parameters}} func v_and_autoclosure(arg : @autoclosure ()->()...) {} // expected-error@+1 {{@escaping attribute may only be used in function parameter position}} func v_and_escaping(arg : @escaping ()->()...) {} // expected-error@+1 {{'inout' must not be used on variadic parameters}} func v_and_inout(arg : inout Int...) {} // expected-error@+1 {{'__shared' must not be used on variadic parameters}} func v_and_shared(arg : __shared Int...) {} // // 'inout' is NOT compatible with remaining parameter flag combinations // // expected-error@+1 {{parameter must not have multiple '__owned', 'inout', '__shared', 'var', or 'let' specifiers}} func inout_and_shared(arg : inout __shared Int) {} // expected-error@+1 {{'inout' may only be used on parameters}} func inout_and_escaping(arg : @escaping inout ()->()) {} // expected-error@+1 {{@escaping attribute may only be used in function parameter position}} func escaping_and_inout(arg : inout @escaping ()->()) {} // expected-error@+1 {{@autoclosure may only be used on parameters}} func inout_and_autoclosure(arg : inout @autoclosure ()->()) {} // expected-error@+1 {{'inout' may only be used on parameters}} func autoclosure_and_inout(arg : @autoclosure inout ()->()) {} // // '__shared' is NOT compatible with remaining parameter flag combinations // // expected-error@+1 {{'__shared' may only be used on parameters}} func autoclosure_and_shared(arg : @autoclosure __shared ()->()) {} // expected-error@+1 {{@autoclosure may only be used on parameters}} func shared_and_autoclosure(arg : __shared @autoclosure ()->()) {} // expected-error@+1 {{'__shared' may only be used on parameters}} func escaping_and_shared(arg : @escaping __shared ()->()) {} // expected-error@+1 {{@escaping attribute may only be used in function parameter position}} func shared_and_escaping(arg : __shared @escaping ()->()) {} // // @autoclosure and @escaping are the only valid parameter flag combinations // func autoclosure_and_escaping(arg : @autoclosure @escaping ()->()) {} func escaping_and_autoclosure(arg : @escaping @autoclosure ()->()) {} _______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev