@@ -845,6 +845,11 @@ void ASTBuilder::pushGenericParams(ArrayRef<std::pair<unsigned, unsigned>> param
845845void ASTBuilder::popGenericParams () {
846846 ParameterPacks = ParameterPackStack.back ();
847847 ParameterPackStack.pop_back ();
848+
849+ if (!ValueParametersStack.empty ()) {
850+ ValueParameters = ValueParametersStack.back ();
851+ ValueParametersStack.pop_back ();
852+ }
848853}
849854
850855Type ASTBuilder::createGenericTypeParameterType (unsigned depth,
@@ -857,6 +862,17 @@ Type ASTBuilder::createGenericTypeParameterType(unsigned depth,
857862 }
858863 }
859864
865+ if (!ValueParameters.empty ()) {
866+ for (auto tuple : ValueParameters) {
867+ auto pair = std::get<std::pair<unsigned , unsigned >>(tuple);
868+ auto type = std::get<Type>(tuple);
869+
870+ if (pair.first == depth && pair.second == index) {
871+ return GenericTypeParamType::getValue (depth, index, type, Ctx);
872+ }
873+ }
874+ }
875+
860876 return GenericTypeParamType::getType (depth, index, Ctx);
861877}
862878
@@ -1049,6 +1065,11 @@ Type ASTBuilder::createNegativeIntegerType(intptr_t value) {
10491065 return IntegerType::get (std::to_string (value), /* isNegative*/ true , Ctx);
10501066}
10511067
1068+ Type ASTBuilder::createBuiltinFixedArrayType (Type size, Type element) {
1069+ return BuiltinFixedArrayType::get (size->getCanonicalType (),
1070+ element->getCanonicalType ());
1071+ }
1072+
10521073GenericSignature
10531074ASTBuilder::createGenericSignature (ArrayRef<BuiltType> builtParams,
10541075 ArrayRef<BuiltRequirement> requirements) {
@@ -1197,9 +1218,18 @@ CanGenericSignature ASTBuilder::demangleGenericSignature(
11971218 // we introduce the parameter packs from the nominal's generic signature.
11981219 ParameterPackStack.push_back (ParameterPacks);
11991220 ParameterPacks.clear ();
1221+
1222+ ValueParametersStack.push_back (ValueParameters);
1223+ ValueParameters.clear ();
12001224 for (auto *paramTy : baseGenericSig.getGenericParams ()) {
12011225 if (paramTy->isParameterPack ())
12021226 ParameterPacks.emplace_back (paramTy->getDepth (), paramTy->getIndex ());
1227+
1228+ if (paramTy->isValue ()) {
1229+ auto pair = std::make_pair (paramTy->getDepth (), paramTy->getIndex ());
1230+ auto tuple = std::make_tuple (pair, paramTy->getValueType ());
1231+ ValueParameters.emplace_back (tuple);
1232+ }
12031233 }
12041234 SWIFT_DEFER { popGenericParams (); };
12051235
0 commit comments