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

Autoscoped constructors in a vector #9630

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ all_same_column aggregates =
If some columns cannot be resolved, `Nothing` is returned. Any issues are
reported to the `Problem_Builder`.
resolve_aggregate : Table -> Problem_Builder -> Aggregate_Column -> Aggregate_Column | Nothing
resolve_aggregate table problem_builder aggregate_column =
resolve_aggregate table problem_builder aggregate_column:Aggregate_Column =
table_columns = table.columns
columns_helper = table.columns_helper

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,9 @@ private Expression translateCall(Tree ast, boolean isMethod) throws SyntaxExcept
var at = args.size();
var self = translateExpression(app.getLhs(), false);
for (var l : app.getExpressions()) {
if (l.getExpression() == null) {
continue;
}
var invoke = isDotOperator(l.getExpression().getOperator().getRight());
if (self == null || !invoke) {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from Standard.Base import all
from Standard.Test import all

import project.Helpers.Table_Aggregate_Auto_Constructor

add_specs suite_builder =
suite_builder.group "Autoconstructor Instrumentation" group_builder->
group_builder.specify "compare ..Count and Aggregate_Column.Count" <|
lines_builder = Vector.new_builder

pair = Table_Aggregate_Auto_Constructor.perform lines_builder.append

lines = lines_builder.to_vector
text = lines.join '\n'

text . should_equal """
enter c6fe8aaf-e963-4f63-a990-d15d230bc9ab
enter c6fe8aaf-e963-4f63-a990-d15d230bc9ab
enter c6fe8aaf-e963-4f63-a990-d15d230bc9ab
callfn c6fe8aaf-e963-4f63-a990-d15d230bc9ab fn: (Count '') args: [Nothing]
result c6fe8aaf-e963-4f63-a990-d15d230bc9ab result: (Count '') type: Aggregate_Column
enter 00e33517-6d19-4f5a-84c5-126f59a93b67
enter 788f7b33-54ae-4452-85ff-4b7b5688b598
result 788f7b33-54ae-4452-85ff-4b7b5688b598 result: Aggregate_Column type: Aggregate_Column.type
enter d1844837-30e7-46b7-bde3-72f7afec52cf
result d1844837-30e7-46b7-bde3-72f7afec52cf result: UnresolvedSymbol<Count> type: Function
enter 00e33517-6d19-4f5a-84c5-126f59a93b67
callfn 00e33517-6d19-4f5a-84c5-126f59a93b67 fn: null self=_ args: [Aggregate_Column]
result 00e33517-6d19-4f5a-84c5-126f59a93b67 result: (Count '') type: Aggregate_Column

pair.first.column_names . should_equal pair.second.column_names
pair.first.column_names.map n->
Copy link
Member Author

@JaroslavTulach JaroslavTulach Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test verifies that both Tables contain the same elements - e.g. resolution of autoscoped constructors works fine in runtime thanks to 5f9aa25 change.

first_vector = pair.first.at n . to_vector
second_vector = pair.second.at n . to_vector
first_vector . should_equal second_vector

main filter=Nothing =
suite = Test.build suite_builder->
add_specs suite_builder
suite.run_with_filter filter
2 changes: 2 additions & 0 deletions test/Table_Tests/src/Helpers/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ from Standard.Base import all

from Standard.Test import all

import project.Helpers.Auto_Constructor_Instrumentation_Spec
import project.Helpers.Sorted_List_Index_Spec
import project.Helpers.Unique_Naming_Strategy_Spec
import project.Helpers.Value_Type_Spec

add_specs suite_builder =
Auto_Constructor_Instrumentation_Spec.add_specs suite_builder
Unique_Naming_Strategy_Spec.add_specs suite_builder
Sorted_List_Index_Spec.add_specs suite_builder
Value_Type_Spec.add_specs suite_builder
Expand Down

Large diffs are not rendered by default.

Loading