Sema: Generalize @_opaqueReturnTypeOf syntax to correctly handle parameter packs

We now allow the dummy identifier to be a qualified reference, so
that we can reconstruct generic parameter lists from multiple levels:

    @_opaqueReturnTypeOf(...) __.<OuterArgs...>.__<InnerArgs...>

This fixes an ambiguity with parameter packs, where flattening the
packs from multiple levels of nested types no longer produced an
unambiguous result.

To maintain backward compatibility, we still accept the old "flat"
form when no parameter packs are present.
This commit is contained in:
Slava Pestov
2025-09-11 18:36:58 -04:00
parent bd3b3ea009
commit af78807313
2 changed files with 91 additions and 21 deletions

View File

@@ -17,7 +17,6 @@
//
// RUN: not %target-swift-frontend -typecheck %s -I %t 2>&1 | %FileCheck %s
// CHECK: cannot find type 'InvalidParameter' in scope
// CHECK: unable to resolve type for _opaqueReturnTypeOf attribute
// CHECK: failed to build module 'InvalidOpaqueResultType' for importation
import InvalidOpaqueResultType