@@ -231,9 +231,6 @@ ReabstractionInfo::createSubstitutedType(SILFunction *OrigF,
231
231
FnTy->getOptionalErrorResult (), M.getASTContext ());
232
232
233
233
// This is an interface type. It should not have any archetypes.
234
- if (NewFnTy->hasArchetype ()) {
235
- NewFnTy->dump ();
236
- }
237
234
assert (!NewFnTy->hasArchetype ());
238
235
return NewFnTy;
239
236
}
@@ -320,13 +317,10 @@ checkSpecializationRequirements(ArrayRef<Requirement> Requirements) {
320
317
auto FirstType = Req.getFirstType ();
321
318
auto SecondType = Req.getSecondType ();
322
319
assert (FirstType && SecondType);
323
-
324
- bool isFirstTypeNonConcrete =
325
- FirstType->hasArchetype () || FirstType->hasTypeParameter ();
326
- bool isSecondTypeNonConcrete =
327
- SecondType->hasArchetype () || SecondType->hasTypeParameter ();
320
+ assert (!FirstType->hasArchetype ());
321
+ assert (!SecondType->hasArchetype ());
328
322
// Only one of the types should be concrete.
329
- assert ((isFirstTypeNonConcrete ^ isSecondTypeNonConcrete ) &&
323
+ assert (FirstType-> hasTypeParameter () != SecondType-> hasTypeParameter ( ) &&
330
324
" Only concrete type same-type requirements are supported by "
331
325
" generic specialization" );
332
326
continue ;
@@ -372,7 +366,7 @@ ReabstractionInfo::ReabstractionInfo(SILFunction *OrigF,
372
366
373
367
for (auto &Req : Requirements) {
374
368
if (Req.getKind () == RequirementKind::SameType) {
375
- auto CallerArchetype = dyn_cast <SubstitutableType>(
369
+ auto CallerArchetype = cast <SubstitutableType>(
376
370
OrigGenericEnv->mapTypeIntoContext (Req.getFirstType ())
377
371
->getCanonicalType ());
378
372
// Remember that a given generic parameter is mapped
@@ -398,7 +392,7 @@ ReabstractionInfo::ReabstractionInfo(SILFunction *OrigF,
398
392
// Remember how the original contextual type is represented in
399
393
// the specialized function.
400
394
if (Req.getKind () == RequirementKind::Layout) {
401
- auto CallerArchetype = dyn_cast <SubstitutableType>(
395
+ auto CallerArchetype = cast <SubstitutableType>(
402
396
OrigGenericEnv->mapTypeIntoContext (Req.getFirstType ())
403
397
->getCanonicalType ());
404
398
@@ -417,7 +411,7 @@ ReabstractionInfo::ReabstractionInfo(SILFunction *OrigF,
417
411
// the caller archetypes to their interface types or the corresponding
418
412
// archetypes in the specialized function.
419
413
for (auto GP : SpecializedGenericSig->getGenericParams ()) {
420
- auto CallerArchetype = dyn_cast <SubstitutableType>(
414
+ auto CallerArchetype = cast <SubstitutableType>(
421
415
OrigGenericEnv->mapTypeIntoContext (GP)->getCanonicalType ());
422
416
if (CallerArchetypeToInterfaceMap.lookupSubstitution (CallerArchetype))
423
417
continue ;
@@ -437,6 +431,8 @@ ReabstractionInfo::ReabstractionInfo(SILFunction *OrigF,
437
431
SmallVector<Substitution, 4 > ClonerSubsList;
438
432
SmallVector<Substitution, 4 > CallerSubsList;
439
433
SmallVector<Substitution, 4 > InterfaceCallerSubsList;
434
+ // FIXME: Clean up the module conformance lookup currently used by subst()
435
+ // calls. They should not directly use module conformance lookup here.
440
436
for (auto Sub : ForwardingSubs) {
441
437
auto ClonerSub = Sub.subst (
442
438
SM, QuerySubstitutionMap{ClonerArchetypeToConcreteMap},
0 commit comments