Skip to content

Commit 2c05b3a

Browse files
author
svorenova
committed
Use type_try_dynamic_cast instead of direct id check and cast
1 parent a449f73 commit 2c05b3a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util/type_eq.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ bool type_eq(const typet &type1, const typet &type2, const namespacet &ns)
3232
if(type1==type2)
3333
return true;
3434

35-
if(type1.id() == ID_symbol_type)
35+
if(const auto symbol_type1 = type_try_dynamic_cast<symbol_typet>(type1))
3636
{
37-
const symbolt &symbol = ns.lookup(to_symbol_type(type1));
37+
const symbolt &symbol = ns.lookup(*symbol_type1);
3838
if(!symbol.is_type)
3939
throw "symbol "+id2string(symbol.name)+" is not a type";
4040

4141
return type_eq(symbol.type, type2, ns);
4242
}
4343

44-
if(type2.id() == ID_symbol_type)
44+
if(const auto symbol_type2 = type_try_dynamic_cast<symbol_typet>(type2))
4545
{
46-
const symbolt &symbol = ns.lookup(to_symbol_type(type2));
46+
const symbolt &symbol = ns.lookup(*symbol_type2);
4747
if(!symbol.is_type)
4848
throw "symbol "+id2string(symbol.name)+" is not a type";
4949

0 commit comments

Comments
 (0)