@@ -5649,18 +5649,20 @@ GenericTypeParamDecl::GenericTypeParamDecl(DeclContext *dc, Identifier name,
56495649 SourceLoc specifierLoc,
56505650 unsigned depth, unsigned index,
56515651 GenericTypeParamKind paramKind,
5652+ bool isOpaqueType,
56525653 TypeRepr *opaqueTypeRepr)
56535654 : TypeDecl(DeclKind::GenericTypeParam, dc, name, nameLoc, {}) {
56545655 ASSERT (!(specifierLoc &&
56555656 !(paramKind == GenericTypeParamKind::Pack || paramKind == GenericTypeParamKind::Value)) &&
56565657 " 'each' or 'let' keyword imply a parameter pack or value generic parameter" );
5658+ ASSERT (isOpaqueType || !opaqueTypeRepr);
56575659
56585660 Bits.GenericTypeParamDecl .Depth = depth;
56595661 assert (Bits.GenericTypeParamDecl .Depth == depth && " Truncation" );
56605662 Bits.GenericTypeParamDecl .Index = index;
56615663 assert (Bits.GenericTypeParamDecl .Index == index && " Truncation" );
56625664 Bits.GenericTypeParamDecl .ParamKind = (uint8_t ) paramKind;
5663- Bits.GenericTypeParamDecl .IsOpaqueType = ( bool ) opaqueTypeRepr ;
5665+ Bits.GenericTypeParamDecl .IsOpaqueType = isOpaqueType ;
56645666
56655667 if (this ->isOpaqueType ())
56665668 *getTrailingObjects<TypeRepr *>() = opaqueTypeRepr;
@@ -5675,7 +5677,7 @@ GenericTypeParamDecl::GenericTypeParamDecl(DeclContext *dc, Identifier name,
56755677GenericTypeParamDecl *GenericTypeParamDecl::create (
56765678 DeclContext *dc, Identifier name, SourceLoc nameLoc, SourceLoc specifierLoc,
56775679 unsigned depth, unsigned index, GenericTypeParamKind paramKind,
5678- TypeRepr *opaqueTypeRepr) {
5680+ bool isOpaqueType, TypeRepr *opaqueTypeRepr) {
56795681 auto &ctx = dc->getASTContext ();
56805682
56815683 auto numTypeReprs = 0 ;
@@ -5694,14 +5696,15 @@ GenericTypeParamDecl *GenericTypeParamDecl::create(
56945696 auto mem = ctx.Allocate (allocSize, alignof (GenericTypeParamDecl));
56955697 return new (mem)
56965698 GenericTypeParamDecl (dc, name, nameLoc, specifierLoc, depth, index,
5697- paramKind, opaqueTypeRepr);
5699+ paramKind, isOpaqueType, opaqueTypeRepr);
56985700}
56995701
57005702GenericTypeParamDecl *GenericTypeParamDecl::createDeserialized (
57015703 DeclContext *dc, Identifier name, unsigned depth, unsigned index,
5702- GenericTypeParamKind paramKind) {
5704+ GenericTypeParamKind paramKind, bool isOpaqueType ) {
57035705 return GenericTypeParamDecl::create (dc, name, SourceLoc (), SourceLoc (),
57045706 depth, index, paramKind,
5707+ isOpaqueType,
57055708 /* opaqueRepr*/ nullptr );
57065709}
57075710
@@ -5715,7 +5718,7 @@ GenericTypeParamDecl::createParsed(DeclContext *dc, Identifier name,
57155718 // parameter list.
57165719 return GenericTypeParamDecl::create (
57175720 dc, name, nameLoc, specifierLoc, GenericTypeParamDecl::InvalidDepth,
5718- index, paramKind, /* opaqueTypeRepr*/ nullptr );
5721+ index, paramKind, /* isOpaqueType */ false , /* opaqueTypeRepr*/ nullptr );
57195722}
57205723
57215724GenericTypeParamDecl *GenericTypeParamDecl::createImplicit (
@@ -5724,6 +5727,7 @@ GenericTypeParamDecl *GenericTypeParamDecl::createImplicit(
57245727 SourceLoc specifierLoc) {
57255728 auto *param = GenericTypeParamDecl::create (dc, name, nameLoc, specifierLoc,
57265729 depth, index, paramKind,
5730+ (bool )opaqueTypeRepr,
57275731 opaqueTypeRepr);
57285732 param->setImplicit ();
57295733 return param;
0 commit comments