Changes in / [c38ae92:c0b23644]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rc38ae92 rc0b23644  
    423423        }
    424424
     425        void checkGenericParameters( ReferenceToType * inst ) {
     426                for ( Expression * param : inst->parameters ) {
     427                        if ( ! dynamic_cast< TypeExpr * >( param ) ) {
     428                                throw SemanticError( "Expression parameters for generic types are currently unsupported: ", inst );
     429                        }
     430                }
     431        }
     432
    425433        void LinkReferenceToTypes::postvisit( StructInstType *structInst ) {
    426434                StructDecl *st = local_indexer->lookupStruct( structInst->get_name() );
     
    434442                        forwardStructs[ structInst->get_name() ].push_back( structInst );
    435443                } // if
     444                checkGenericParameters( structInst );
    436445        }
    437446
     
    446455                        forwardUnions[ unionInst->get_name() ].push_back( unionInst );
    447456                } // if
     457                checkGenericParameters( unionInst );
    448458        }
    449459
     
    525535                // need to carry over the 'sized' status of each decl in the instance
    526536                for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
    527                         TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( std::get<1>(p) );
     537                        TypeExpr * expr = dynamic_cast< TypeExpr * >( std::get<1>(p) );
     538                        if ( ! expr ) {
     539                                throw SemanticError( "Expression parameters for trait instances are currently unsupported: ", std::get<1>(p) );
     540                        }
    528541                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
    529542                                TypeDecl * formalDecl = std::get<0>(p);
Note: See TracChangeset for help on using the changeset viewer.