Skip to content

Commit 781a73b

Browse files
committed
Remove TypeInference::unifyGeneralized()
1 parent bbc85f0 commit 781a73b

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

libsolidity/experimental/analysis/TypeInference.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,17 +1079,9 @@ TypeRegistration::TypeClassInstantiations const& typeClassInstantiations(Analysi
10791079
}
10801080
}
10811081

1082-
void TypeInference::unifyGeneralized(Type _type, Type _scheme, std::vector<Type> _monomorphicTypes, langutil::SourceLocation _location)
1082+
experimental::Type TypeInference::polymorphicInstance(Type const& _scheme)
10831083
{
1084-
solUnimplementedAssert(_monomorphicTypes.empty(), "unsupported");
1085-
unify(_type, m_env->fresh(_scheme), _location);
1086-
}
1087-
1088-
experimental::Type TypeInference::polymorphicInstance(Type _scheme, langutil::SourceLocation _location)
1089-
{
1090-
TypeVariable result = m_typeSystem.freshTypeVariable({});
1091-
unifyGeneralized(result, _scheme, {}, _location);
1092-
return result;
1084+
return m_env->fresh(_scheme);
10931085
}
10941086

10951087
void TypeInference::unify(Type _a, Type _b, langutil::SourceLocation _location)

libsolidity/experimental/analysis/TypeInference.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ class TypeInference: public ASTConstVisitor
110110
GlobalAnnotation& annotation();
111111

112112
void unify(Type _a, Type _b, langutil::SourceLocation _location = {});
113-
void unifyGeneralized(Type _type, Type _scheme, std::vector<Type> _monomorphicTypes, langutil::SourceLocation _location = {});
114-
Type polymorphicInstance(Type _scheme, langutil::SourceLocation _location = {});
113+
/// Creates a polymorphic instance of a global type scheme
114+
Type polymorphicInstance(Type const& _scheme);
115115
Type memberType(Type _type, std::string _memberName, langutil::SourceLocation _location = {});
116116
enum class ExpressionContext { Term, Type, Sort };
117117
Type handleIdentifierByReferencedDeclaration(langutil::SourceLocation _location, Declaration const& _declaration);

test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ contract C {
8383
// Info 4164: (525-529): Inferred type: word
8484
// Info 4164: (540-553): Inferred type: bool
8585
// Info 4164: (540-550): Inferred type: (bool, word) -> bool
86-
// Info 4164: (540-544): Inferred type: ('cb:type, 'cc:type)
86+
// Info 4164: (540-544): Inferred type: ('bl:type, 'bm:type)
8787
// Info 4164: (551-552): Inferred type: (bool, word)
8888
// Info 4164: (563-577): Inferred type: word
8989
// Info 4164: (563-574): Inferred type: (bool, word) -> word
90-
// Info 4164: (563-567): Inferred type: ('ci:type, 'cj:type)
90+
// Info 4164: (563-567): Inferred type: ('bq:type, 'br:type)
9191
// Info 4164: (575-576): Inferred type: (bool, word)

0 commit comments

Comments
 (0)