File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2564,6 +2564,12 @@ BoundGenericType::BoundGenericType(TypeKind theKind,
2564
2564
BoundGenericType *BoundGenericType::get (NominalTypeDecl *TheDecl,
2565
2565
Type Parent,
2566
2566
ArrayRef<Type> GenericArgs) {
2567
+ assert (TheDecl->getGenericParams () && " must be a generic type decl" );
2568
+ assert ((!Parent || Parent->is <NominalType>() ||
2569
+ Parent->is <BoundGenericType>() ||
2570
+ Parent->is <UnboundGenericType>()) &&
2571
+ " parent must be a nominal type" );
2572
+
2567
2573
ASTContext &C = TheDecl->getDeclContext ()->getASTContext ();
2568
2574
llvm::FoldingSetNodeID ID;
2569
2575
RecursiveTypeProperties properties;
@@ -2609,6 +2615,13 @@ BoundGenericType *BoundGenericType::get(NominalTypeDecl *TheDecl,
2609
2615
}
2610
2616
2611
2617
NominalType *NominalType::get (NominalTypeDecl *D, Type Parent, const ASTContext &C) {
2618
+ assert ((isa<ProtocolDecl>(D) || !D->getGenericParams ()) &&
2619
+ " must be a non-generic type decl" );
2620
+ assert ((!Parent || Parent->is <NominalType>() ||
2621
+ Parent->is <BoundGenericType>() ||
2622
+ Parent->is <UnboundGenericType>()) &&
2623
+ " parent must be a nominal type" );
2624
+
2612
2625
switch (D->getKind ()) {
2613
2626
case DeclKind::Enum:
2614
2627
return EnumType::get (cast<EnumDecl>(D), Parent, C);
You can’t perform that action at this time.
0 commit comments