Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pair.to Meta.Type . qualified_name fix #12214

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion distribution/lib/Standard/Base/0.0.0-dev/src/Meta.enso
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,5 @@ is_polyglot value -> Boolean = 3 == Meta_Helpers.get_kind_builtin value
Arguments:
- value: the value to get the type of
Type.from (that:Any) =
typ = Meta.type_of that
typ = if Meta.is_type that then that else Meta.type_of that
Type.Value typ
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ private boolean compareQualifiedNameOfValue(Value sn, Value v, StringBuilder sb)
}
var meta = v.getMetaObject();
var metaName = meta != null ? meta.getMetaSimpleName() : "null";
if (metaName.endsWith(".type")) {
metaName = metaName.substring(0, metaName.length() - 5);
}
if (!simpleName.equals(metaName)) {
if (v.isHostObject()) {
if (v.hasArrayElements()) {
Expand Down Expand Up @@ -407,7 +410,7 @@ public void compareQualifiedAndSimpleTypeNameForTypes() throws Exception {
}

var simpleName = sn.execute(typ).asString();
var metaName = typ.getMetaSimpleName() + ".type";
var metaName = typ.getMetaSimpleName();
if (!simpleName.equals(metaName)) {
sb.append("\n")
.append("Simple names shall be the same for ")
Expand Down
10 changes: 10 additions & 0 deletions test/Base_Tests/src/Semantic/Meta_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,16 @@ add_specs suite_builder =
typ = Meta.Type.find fqn
typ . should_equal meta_type

suite_builder.group ".to Meta.Type" group_builder->
group_builder.specify "Type of Pair type" <|
fqn = Pair.to Meta.Type . qualified_name
fqn . should_equal "Standard.Base.Data.Pair.Pair"

group_builder.specify "Type of Pair value" <|
p = Pair.new "A" 2
fqn = p.to Meta.Type . qualified_name
fqn . should_equal "Standard.Base.Data.Pair.Pair"

main filter=Nothing =
suite = Test.build suite_builder->
add_specs suite_builder
Expand Down
Loading