Skip to content

Commit

Permalink
Remove TypeInference::unifyGeneralized()
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Oct 30, 2023
1 parent bbc85f0 commit 781a73b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
12 changes: 2 additions & 10 deletions libsolidity/experimental/analysis/TypeInference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,17 +1079,9 @@ TypeRegistration::TypeClassInstantiations const& typeClassInstantiations(Analysi
}
}

void TypeInference::unifyGeneralized(Type _type, Type _scheme, std::vector<Type> _monomorphicTypes, langutil::SourceLocation _location)
experimental::Type TypeInference::polymorphicInstance(Type const& _scheme)
{
solUnimplementedAssert(_monomorphicTypes.empty(), "unsupported");
unify(_type, m_env->fresh(_scheme), _location);
}

experimental::Type TypeInference::polymorphicInstance(Type _scheme, langutil::SourceLocation _location)
{
TypeVariable result = m_typeSystem.freshTypeVariable({});
unifyGeneralized(result, _scheme, {}, _location);
return result;
return m_env->fresh(_scheme);
}

void TypeInference::unify(Type _a, Type _b, langutil::SourceLocation _location)
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/experimental/analysis/TypeInference.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class TypeInference: public ASTConstVisitor
GlobalAnnotation& annotation();

void unify(Type _a, Type _b, langutil::SourceLocation _location = {});
void unifyGeneralized(Type _type, Type _scheme, std::vector<Type> _monomorphicTypes, langutil::SourceLocation _location = {});
Type polymorphicInstance(Type _scheme, langutil::SourceLocation _location = {});
/// Creates a polymorphic instance of a global type scheme
Type polymorphicInstance(Type const& _scheme);
Type memberType(Type _type, std::string _memberName, langutil::SourceLocation _location = {});
enum class ExpressionContext { Term, Type, Sort };
Type handleIdentifierByReferencedDeclaration(langutil::SourceLocation _location, Declaration const& _declaration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ contract C {
// Info 4164: (525-529): Inferred type: word
// Info 4164: (540-553): Inferred type: bool
// Info 4164: (540-550): Inferred type: (bool, word) -> bool
// Info 4164: (540-544): Inferred type: ('cb:type, 'cc:type)
// Info 4164: (540-544): Inferred type: ('bl:type, 'bm:type)
// Info 4164: (551-552): Inferred type: (bool, word)
// Info 4164: (563-577): Inferred type: word
// Info 4164: (563-574): Inferred type: (bool, word) -> word
// Info 4164: (563-567): Inferred type: ('ci:type, 'cj:type)
// Info 4164: (563-567): Inferred type: ('bq:type, 'br:type)
// Info 4164: (575-576): Inferred type: (bool, word)

0 comments on commit 781a73b

Please sign in to comment.