@@ -261,6 +261,16 @@ getTypeForSymbolRange(const Symbol *begin, const Symbol *end, Type root,
261
261
// Return a sugared GenericTypeParamType if we're given an array of
262
262
// sugared types to substitute.
263
263
unsigned index = GenericParamKey (genericParam).findIndexIn (genericParams);
264
+
265
+ if (index == genericParams.size ()) {
266
+ llvm::errs () << " Invalid generic parameter: " << genericParam << " \n " ;
267
+ llvm::errs () << " Valid generic parameters are" ;
268
+ for (auto *otherParam : genericParams)
269
+ llvm::errs () << " " << Type (otherParam);
270
+ llvm::errs () << " \n " ;
271
+ abort ();
272
+ }
273
+
264
274
result = genericParams[index];
265
275
return ;
266
276
}
@@ -344,7 +354,14 @@ getTypeForSymbolRange(const Symbol *begin, const Symbol *end, Type root,
344
354
assert (prefix.size () > 0 );
345
355
346
356
auto *props = map.lookUpProperties (prefix.rbegin (), prefix.rend ());
347
- assert (props != nullptr );
357
+ if (props == nullptr ) {
358
+ llvm::errs () << " Cannot build interface type for term "
359
+ << MutableTerm (begin, end) << " \n " ;
360
+ llvm::errs () << " Prefix does not conform to any protocols: "
361
+ << prefix << " \n\n " ;
362
+ map.dump (llvm::errs ());
363
+ abort ();
364
+ }
348
365
349
366
// Assert that the associated type's protocol appears among the set
350
367
// of protocols that the prefix conforms to.
@@ -356,6 +373,18 @@ getTypeForSymbolRange(const Symbol *begin, const Symbol *end, Type root,
356
373
#endif
357
374
358
375
assocType = props->getAssociatedType (symbol.getName ());
376
+ if (assocType == nullptr ) {
377
+ llvm::errs () << " Cannot build interface type for term "
378
+ << MutableTerm (begin, end) << " \n " ;
379
+ llvm::errs () << " Prefix term does not not have a nested type named "
380
+ << symbol.getName () << " : "
381
+ << prefix << " \n " ;
382
+ llvm::errs () << " Property map entry: " ;
383
+ props->dump (llvm::errs ());
384
+ llvm::errs () << " \n\n " ;
385
+ map.dump (llvm::errs ());
386
+ abort ();
387
+ }
359
388
}
360
389
361
390
result = DependentMemberType::get (result, assocType);
0 commit comments