Changeset e172f42 for src/ResolvExpr/Unify.cc
- Timestamp:
- Jun 16, 2023, 9:10:46 AM (2 years ago)
- Branches:
- master
- Children:
- 5dbb9f3
- Parents:
- a0bd9a2 (diff), 62d62db (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
ra0bd9a2 re172f42 160 160 env.apply( newSecond ); 161 161 162 findOpenVars( newFirst, open, closed, need, have, FirstClosed );163 findOpenVars( newSecond, open, closed, need, have, FirstOpen );162 // findOpenVars( newFirst, open, closed, need, have, FirstClosed ); 163 findOpenVars( newSecond, open, closed, need, have, newEnv, FirstOpen ); 164 164 165 165 return unifyExact(newFirst, newSecond, newEnv, need, have, open, noWiden() ); … … 964 964 // check that the other type is compatible and named the same 965 965 auto otherInst = dynamic_cast< const XInstType * >( other ); 966 if (otherInst && inst->name == otherInst->name) this->result = otherInst; 966 if (otherInst && inst->name == otherInst->name) 967 this->result = otherInst; 967 968 return otherInst; 968 969 } … … 1049 1050 1050 1051 void postvisit( const ast::TypeInstType * typeInst ) { 1051 assert( open.find( *typeInst ) == open.end() ); 1052 handleRefType( typeInst, type2 ); 1052 // assert( open.find( *typeInst ) == open.end() ); 1053 auto otherInst = dynamic_cast< const ast::TypeInstType * >( type2 ); 1054 if (otherInst && typeInst->name == otherInst->name) 1055 this->result = otherInst; 1056 // return otherInst; 1053 1057 } 1054 1058 … … 1161 1165 ) { 1162 1166 ast::OpenVarSet closed; 1163 findOpenVars( type1, open, closed, need, have, FirstClosed );1164 findOpenVars( type2, open, closed, need, have, FirstOpen );1167 // findOpenVars( type1, open, closed, need, have, FirstClosed ); 1168 findOpenVars( type2, open, closed, need, have, env, FirstOpen ); 1165 1169 return unifyInexact( 1166 1170 type1, type2, env, need, have, open, WidenMode{ true, true }, common ); … … 1179 1183 entry1 = var1 ? open.find( *var1 ) : open.end(), 1180 1184 entry2 = var2 ? open.find( *var2 ) : open.end(); 1181 bool isopen1 = entry1 != open.end(); 1182 bool isopen2 = entry2 != open.end(); 1183 1185 // bool isopen1 = entry1 != open.end(); 1186 // bool isopen2 = entry2 != open.end(); 1187 bool isopen1 = var1 && env.lookup(*var1); 1188 bool isopen2 = var2 && env.lookup(*var2); 1189 1190 /* 1184 1191 if ( isopen1 && isopen2 ) { 1185 1192 if ( entry1->second.kind != entry2->second.kind ) return false; … … 1190 1197 return env.bindVar( var1, type2, entry1->second, need, have, open, widen ); 1191 1198 } else if ( isopen2 ) { 1192 return env.bindVar( var2, type1, entry2->second, need, have, open, widen ); 1193 } else { 1199 return env.bindVar( var2, type1, entry2->second, need, have, open, widen, symtab ); 1200 } */ 1201 if ( isopen1 && isopen2 ) { 1202 if ( var1->base->kind != var2->base->kind ) return false; 1203 return env.bindVarToVar( 1204 var1, var2, ast::TypeData{ var1->base->kind, var1->base->sized||var2->base->sized }, need, have, 1205 open, widen ); 1206 } else if ( isopen1 ) { 1207 return env.bindVar( var1, type2, ast::TypeData{var1->base}, need, have, open, widen ); 1208 } else if ( isopen2 ) { 1209 return env.bindVar( var2, type1, ast::TypeData{var2->base}, need, have, open, widen ); 1210 }else { 1194 1211 return ast::Pass<Unify_new>::read( 1195 1212 type1, type2, env, need, have, open, widen ); 1196 1213 } 1214 1197 1215 } 1198 1216
Note:
See TracChangeset
for help on using the changeset viewer.