@@ -82,24 +82,22 @@ void main() {
8282 reason: 'a forward-declared class cannot be returned by value' ,
8383 );
8484
85- // Unsupported today: bindable in principle (a reference is ABI-wise a
86- // pointer; a defined class could be heap-copied by the glue code). If
87- // support is ever added, move these up to the bindable group with real
88- // signature expectations instead of relaxing the checks.
8985 expect (
9086 methodNames,
91- isNot ( contains ('badRef' ) ),
92- reason: 'a C++ reference return type has no Dart mapping ' ,
87+ contains ('badSelfByValue' ),
88+ reason: 'a defined class returned by value is supported ' ,
9389 );
90+
91+ // Unsupported today: references have no Dart mapping.
9492 expect (
9593 methodNames,
96- isNot (contains ('badConstRef ' )),
94+ isNot (contains ('badRef ' )),
9795 reason: 'a C++ reference return type has no Dart mapping' ,
9896 );
9997 expect (
10098 methodNames,
101- isNot (contains ('badSelfByValue ' )),
102- reason: 'a defined class returned by value is not supported ' ,
99+ isNot (contains ('badConstRef ' )),
100+ reason: 'a C++ reference return type has no Dart mapping ' ,
103101 );
104102 });
105103
@@ -116,6 +114,11 @@ void main() {
116114 'primitives and pointers (even to an incomplete compound or a '
117115 'C++ class) are bindable parameter types' ,
118116 );
117+ expect (
118+ methodNames,
119+ contains ('badSelfParam' ),
120+ reason: 'a defined class passed by value is supported' ,
121+ );
119122
120123 // Never bindable: a parameter whose type has no definition anywhere in
121124 // the translation unit cannot be passed by value (C++ itself cannot
@@ -137,9 +140,7 @@ void main() {
137140 reason: 'a forward-declared class cannot be passed by value' ,
138141 );
139142
140- // Unsupported today: bindable in principle, see the equivalent return
141- // type group above. If support is ever added, move these up to the
142- // bindable group with real signature expectations.
143+ // Unsupported today: references have no Dart mapping.
143144 expect (
144145 methodNames,
145146 isNot (contains ('badRefParam' )),
@@ -150,11 +151,6 @@ void main() {
150151 isNot (contains ('badConstRefParam' )),
151152 reason: 'a C++ reference parameter has no Dart mapping' ,
152153 );
153- expect (
154- methodNames,
155- isNot (contains ('badSelfParam' )),
156- reason: 'a defined class passed by value is not supported' ,
157- );
158154
159155 // The copy constructor takes a C++ reference, so only the default
160156 // constructor survives.
@@ -174,22 +170,21 @@ void main() {
174170 expect (output, contains ('Widget_self' ));
175171 expect (output, contains ('Widget_blobPtr' ));
176172 expect (output, contains ('Widget_goodParams' ));
177- // See the grouping in the return type test: the first three can never be
178- // supported; the last three pin behavior that a future version may
179- // relax, and should then move to positive expectations above.
173+ expect (output, contains ('Widget_badSelfByValue' ));
174+ expect (output, contains ('Widget_badSelfParam' ));
175+
176+ // Unsupported returns:
180177 expect (output, isNot (contains ('badUnionByValue' )));
181178 expect (output, isNot (contains ('badAliasByValue' )));
182179 expect (output, isNot (contains ('badClassByValue' )));
183180 expect (output, isNot (contains ('badRef' )));
184181 expect (output, isNot (contains ('badConstRef' )));
185- expect (output, isNot (contains ('badSelfByValue' )));
186- // Same for the unsupported parameter types (badRefParam and
187- // badConstRefParam are covered by the badRef/badConstRef prefix checks
188- // above).
182+
183+ // Unsupported parameters:
189184 expect (output, isNot (contains ('badUnionParam' )));
190185 expect (output, isNot (contains ('badAliasParam' )));
191186 expect (output, isNot (contains ('badClassParam' )));
192- expect (output, isNot ( contains ( 'badSelfParam' )));
187+
193188 // With its only use dropped, the forward-declared class must not leave
194189 // a wrapper class behind in the bindings.
195190 expect (output, isNot (contains ('class Incomplete' )));
0 commit comments