@@ -1883,23 +1883,39 @@ public func closureClassUseAfterConsumeArg(_ argX: inout Klass) {
1883
1883
public func closureCaptureClassUseAfterConsume( ) {
1884
1884
var x2 = Klass ( )
1885
1885
// expected-error @-1 {{Usage of a move only type that the move checker does not know how to check!}}
1886
+ // expected-error @-2 {{'x2' consumed in closure but not reinitialized before end of closure}}
1887
+ // expected-error @-3 {{'x2' consumed more than once}}
1888
+ // expected-error @-4 {{'x2' consumed more than once}}
1886
1889
x2 = Klass ( )
1887
1890
let f = {
1888
1891
classUseMoveOnlyWithoutEscaping ( x2)
1889
1892
classConsume ( x2)
1893
+ // expected-note @-1 {{consuming use}}
1894
+ // expected-note @-2 {{consuming use}}
1890
1895
print ( x2)
1896
+ // expected-note @-1 {{consuming use}}
1897
+ // expected-note @-2 {{consuming use}}
1898
+ // expected-note @-3 {{consuming use}}
1891
1899
}
1892
1900
f ( )
1893
1901
}
1894
1902
1895
1903
public func closureCaptureClassUseAfterConsumeError( ) {
1896
1904
var x2 = Klass ( )
1897
1905
// expected-error @-1 {{Usage of a move only type that the move checker does not know how to check!}}
1906
+ // expected-error @-2 {{'x2' consumed more than once}}
1907
+ // expected-error @-3 {{'x2' consumed more than once}}
1908
+ // expected-error @-4 {{'x2' consumed in closure but not reinitialized before end of closure}}
1898
1909
x2 = Klass ( )
1899
1910
let f = {
1900
1911
classUseMoveOnlyWithoutEscaping ( x2)
1901
1912
classConsume ( x2)
1913
+ // expected-note @-1 {{consuming use}}
1914
+ // expected-note @-2 {{consuming use}}
1902
1915
print ( x2)
1916
+ // expected-note @-1 {{consuming use}}
1917
+ // expected-note @-2 {{consuming use}}
1918
+ // expected-note @-3 {{consuming use}}
1903
1919
}
1904
1920
f ( )
1905
1921
let x3 = x2
@@ -1908,7 +1924,7 @@ public func closureCaptureClassUseAfterConsumeError() {
1908
1924
1909
1925
public func closureCaptureClassArgUseAfterConsume( _ x2: inout Klass ) {
1910
1926
// expected-error @-1 {{'x2' consumed but not reinitialized before end of function}}
1911
- // expected-error @-2 {{'x2' consumed but not reinitialized before end of function }}
1927
+ // expected-error @-2 {{'x2' consumed in closure but not reinitialized before end of closure }}
1912
1928
// expected-error @-3 {{'x2' consumed more than once}}
1913
1929
// expected-note @-4 {{'x2' is declared 'inout'}}
1914
1930
let f = { // expected-note {{consuming use}}
@@ -1926,7 +1942,7 @@ public func closureCaptureClassArgUseAfterConsume(_ x2: inout Klass) {
1926
1942
// TODO: Improve error msg here to make it clear the use is due to the defer.
1927
1943
public func deferCaptureClassUseAfterConsume( ) {
1928
1944
var x2 = Klass ( )
1929
- // expected-error @-1 {{'x2' consumed but not reinitialized before end of function }}
1945
+ // expected-error @-1 {{'x2' consumed in closure but not reinitialized before end of closure }}
1930
1946
// expected-error @-2 {{'x2' consumed more than once}}
1931
1947
x2 = Klass ( )
1932
1948
defer {
@@ -1940,7 +1956,7 @@ public func deferCaptureClassUseAfterConsume() {
1940
1956
1941
1957
public func deferCaptureClassUseAfterConsume2( ) {
1942
1958
var x2 = Klass ( )
1943
- // expected-error @-1 {{'x2' consumed but not reinitialized before end of function }}
1959
+ // expected-error @-1 {{'x2' consumed in closure but not reinitialized before end of closure }}
1944
1960
// expected-error @-2 {{'x2' consumed more than once}}
1945
1961
x2 = Klass ( )
1946
1962
defer {
@@ -1955,7 +1971,7 @@ public func deferCaptureClassUseAfterConsume2() {
1955
1971
}
1956
1972
1957
1973
public func deferCaptureClassArgUseAfterConsume( _ x2: inout Klass ) {
1958
- // expected-error @-1 {{'x2' consumed but not reinitialized before end of function }}
1974
+ // expected-error @-1 {{'x2' consumed in closure but not reinitialized before end of closure }}
1959
1975
// expected-error @-2 {{'x2' consumed more than once}}
1960
1976
classUseMoveOnlyWithoutEscaping ( x2)
1961
1977
defer {
@@ -1970,7 +1986,7 @@ public func deferCaptureClassArgUseAfterConsume(_ x2: inout Klass) {
1970
1986
public func closureAndDeferCaptureClassUseAfterConsume( ) {
1971
1987
var x2 = Klass ( )
1972
1988
// expected-error @-1 {{Usage of a move only type that the move checker does not know how to check!}}
1973
- // expected-error @-2 {{'x2' consumed but not reinitialized before end of function }}
1989
+ // expected-error @-2 {{'x2' consumed in closure but not reinitialized before end of closure }}
1974
1990
// expected-error @-3 {{'x2' consumed more than once}}
1975
1991
x2 = Klass ( )
1976
1992
let f = {
@@ -1988,7 +2004,7 @@ public func closureAndDeferCaptureClassUseAfterConsume() {
1988
2004
1989
2005
public func closureAndDeferCaptureClassUseAfterConsume2( ) {
1990
2006
var x2 = Klass ( )
1991
- // expected-error @-1 {{'x2' consumed but not reinitialized before end of function }}
2007
+ // expected-error @-1 {{'x2' consumed in closure but not reinitialized before end of closure }}
1992
2008
// expected-error @-2 {{Usage of a move only type that the move checker does not know how to check!}}
1993
2009
// expected-error @-3 {{'x2' consumed more than once}}
1994
2010
x2 = Klass ( )
@@ -2008,7 +2024,7 @@ public func closureAndDeferCaptureClassUseAfterConsume2() {
2008
2024
2009
2025
public func closureAndDeferCaptureClassUseAfterConsume3( ) {
2010
2026
var x2 = Klass ( )
2011
- // expected-error @-1 {{'x2' consumed but not reinitialized before end of function }}
2027
+ // expected-error @-1 {{'x2' consumed in closure but not reinitialized before end of closure }}
2012
2028
// expected-error @-2 {{Usage of a move only type that the move checker does not know how to check!}}
2013
2029
// expected-error @-3 {{'x2' consumed more than once}}
2014
2030
x2 = Klass ( )
@@ -2029,7 +2045,7 @@ public func closureAndDeferCaptureClassUseAfterConsume3() {
2029
2045
2030
2046
public func closureAndDeferCaptureClassArgUseAfterConsume( _ x2: inout Klass ) {
2031
2047
// expected-error @-1 {{'x2' consumed but not reinitialized before end of function}}
2032
- // expected-error @-2 {{'x2' consumed but not reinitialized before end of function }}
2048
+ // expected-error @-2 {{'x2' consumed in closure but not reinitialized before end of closure }}
2033
2049
// expected-error @-3 {{'x2' consumed more than once}}
2034
2050
// expected-note @-4 {{'x2' is declared 'inout'}}
2035
2051
let f = { // expected-error {{escaping closure captures 'inout' parameter 'x2'}}
@@ -2050,12 +2066,22 @@ public func closureAndDeferCaptureClassArgUseAfterConsume(_ x2: inout Klass) {
2050
2066
public func closureAndClosureCaptureClassUseAfterConsume( ) {
2051
2067
var x2 = Klass ( )
2052
2068
// expected-error @-1 {{Usage of a move only type that the move checker does not know how to check!}}
2069
+ // expected-error @-2 {{Usage of a move only type that the move checker does not know how to check!}}
2070
+ // expected-error @-3 {{'x2' consumed more than once}}
2071
+ // expected-error @-4 {{'x2' consumed in closure but not reinitialized before end of closure}}
2072
+ // expected-error @-5 {{Usage of a move only type that the move checker does not know how to check!}}
2073
+ // expected-error @-6 {{'x2' consumed more than once}}
2053
2074
x2 = Klass ( )
2054
2075
let f = {
2055
2076
let g = {
2056
2077
classUseMoveOnlyWithoutEscaping ( x2)
2057
2078
classConsume ( x2)
2079
+ // expected-note @-1 {{consuming use}}
2080
+ // expected-note @-2 {{consuming use}}
2058
2081
print ( x2)
2082
+ // expected-note @-1 {{consuming use}}
2083
+ // expected-note @-2 {{consuming use}}
2084
+ // expected-note @-3 {{consuming use}}
2059
2085
}
2060
2086
g ( )
2061
2087
}
@@ -2065,12 +2091,22 @@ public func closureAndClosureCaptureClassUseAfterConsume() {
2065
2091
public func closureAndClosureCaptureClassUseAfterConsume2( ) {
2066
2092
var x2 = Klass ( )
2067
2093
// expected-error @-1 {{Usage of a move only type that the move checker does not know how to check!}}
2094
+ // expected-error @-2 {{Usage of a move only type that the move checker does not know how to check!}}
2095
+ // expected-error @-3 {{'x2' consumed in closure but not reinitialized before end of closure}}
2096
+ // expected-error @-4 {{'x2' consumed more than once}}
2097
+ // expected-error @-5 {{'x2' consumed more than once}}
2098
+ // expected-error @-6 {{Usage of a move only type that the move checker does not know how to check!}}
2068
2099
x2 = Klass ( )
2069
2100
let f = {
2070
2101
let g = {
2071
2102
classUseMoveOnlyWithoutEscaping ( x2)
2072
2103
classConsume ( x2)
2104
+ // expected-note @-1 {{consuming use}}
2105
+ // expected-note @-2 {{consuming use}}
2073
2106
print ( x2)
2107
+ // expected-note @-1 {{consuming use}}
2108
+ // expected-note @-2 {{consuming use}}
2109
+ // expected-note @-3 {{consuming use}}
2074
2110
}
2075
2111
g ( )
2076
2112
}
@@ -2081,8 +2117,8 @@ public func closureAndClosureCaptureClassUseAfterConsume2() {
2081
2117
2082
2118
public func closureAndClosureCaptureClassArgUseAfterConsume( _ x2: inout Klass ) {
2083
2119
// expected-error @-1 {{'x2' consumed but not reinitialized before end of function}}
2084
- // expected-error @-2 {{'x2' consumed but not reinitialized before end of function }}
2085
- // expected-error @-3 {{'x2' consumed but not reinitialized before end of function }}
2120
+ // expected-error @-2 {{'x2' consumed in closure but not reinitialized before end of closure }}
2121
+ // expected-error @-3 {{'x2' consumed in closure but not reinitialized before end of closure }}
2086
2122
// expected-error @-4 {{'x2' consumed more than once}}
2087
2123
// expected-note @-5 {{'x2' is declared 'inout'}}
2088
2124
// expected-note @-6 {{'x2' is declared 'inout'}}
0 commit comments