File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -9425,6 +9425,22 @@ class ABIDeclChecker : public ASTComparisonVisitor<ABIDeclChecker> {
9425
9425
if (!normConstraint->isExistentialType ())
9426
9426
return normConstraint;
9427
9427
}
9428
+
9429
+ // Tuples: Remove labels.
9430
+ if (auto tuple = original->getAs <TupleType>()) {
9431
+ bool needsNormalization = false ;
9432
+ SmallVector<TupleTypeElt, 8 > unlabeledElements;
9433
+
9434
+ for (auto elem : tuple->getElements ()) {
9435
+ needsNormalization |= !elem.getName ().empty ();
9436
+ unlabeledElements.push_back (elem.getWithoutName ());
9437
+ }
9438
+
9439
+ if (!needsNormalization)
9440
+ return tuple;
9441
+
9442
+ return TupleType::get (unlabeledElements, tuple->getASTContext ());
9443
+ }
9428
9444
9429
9445
// TODO: Allow Optional/non-Optional variance when ABI-compatible?
9430
9446
// TODO: Allow variance in exact class of object?
Original file line number Diff line number Diff line change @@ -378,6 +378,15 @@ func intForFloatParam(_: Int) -> Int { fatalError() } // expected-note @:26 {{sh
378
378
@abi( func floatForIntResult( _: Int) - > Float) // expected-error @:40 {{type 'Float' in '@abi' should match 'Int'}}
379
379
func intForFloatResult( _: Int) - > Int { fatalError ( ) } // expected-note @:35 {{should match type here}}
380
380
381
+ @abi( func labeledForUnlabeledTuple( _: ( x: Int, y: Int) ) )
382
+ func labeledForUnlabeledTuple( _: ( Int, Int) ) { }
383
+
384
+ @abi( func unlabeledForLabeledTuple( _: ( Int, Int) ) )
385
+ func unlabeledForLabeledTuple( _: ( x: Int, y: Int) ) { }
386
+
387
+ @abi( func labeledForLabeledTuple( _: ( x: Int, y: Int) ) )
388
+ func labeledForLabeledTuple( _: ( a: Int, b: Int) ) { }
389
+
381
390
@abi(
382
391
func testDefaultArguments(
383
392
a: Int,
You can’t perform that action at this time.
0 commit comments