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

Runtime check of ascribed types #6790

Merged
merged 36 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
18abc60
Use ascribed types in ReadArgumentNode
JaroslavTulach May 15, 2023
b90cd6e
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Ascrib…
JaroslavTulach May 22, 2023
81295da
Bound type is available directly in the Interval module
JaroslavTulach May 22, 2023
4ebea38
Context is directly imported
JaroslavTulach May 22, 2023
3358d6b
Accept type parameters in ascribed signatures
JaroslavTulach May 22, 2023
947a58f
It's Utf_16_Span
JaroslavTulach May 22, 2023
d472f18
Type_Error.Error when wrong type is send to ascribed constructor
JaroslavTulach May 22, 2023
b5125a3
Everything that hasHashEntries is of type Map
JaroslavTulach May 23, 2023
927b42f
Unignore method that was crashing the old parser
JaroslavTulach May 23, 2023
26168fd
Formatting
JaroslavTulach May 23, 2023
2134148
Caching ValuesGenerator speeds the test from 80s to 20s
JaroslavTulach May 23, 2023
f144268
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Ascrib…
JaroslavTulach May 23, 2023
e2c7ed5
Running the MetaIsATest also with JavaScript enabled
JaroslavTulach May 23, 2023
17fe010
Special isDate and isTime checks
JaroslavTulach May 23, 2023
2796679
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Ascrib…
JaroslavTulach May 24, 2023
8d345b9
Everything that hasHashEntries is a Map
JaroslavTulach May 24, 2023
e72620f
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Ascrib…
JaroslavTulach May 25, 2023
e17f619
Renaming and typo fixing
JaroslavTulach May 25, 2023
b5c19f6
Applying scala formatting/coding suggestions
JaroslavTulach May 25, 2023
34e0a2c
Less of currly braces
JaroslavTulach May 25, 2023
fe89655
Support for ascribed union types
JaroslavTulach May 25, 2023
52c0357
Better error messages
JaroslavTulach May 25, 2023
ccf7ef0
Support for nested union and parameterized types
JaroslavTulach May 26, 2023
9528617
Errors get in without any type checks
JaroslavTulach May 26, 2023
9ad5d54
Produces Type_Error instead of Unsupported_Argument_Types now
JaroslavTulach May 26, 2023
eb60cad
Allowing Column to make test/Benchmarks pass the runtime argument typ…
JaroslavTulach May 26, 2023
31dff3c
line_endings can be Infer-ed
JaroslavTulach May 28, 2023
fe0edb0
Store location of atom constructors
JaroslavTulach May 29, 2023
19f753f
Opt-out of type checks to make test/Visualization_Tests pass
JaroslavTulach May 30, 2023
35f86a4
Skip type check of lazy arguments
JaroslavTulach May 30, 2023
5ca27c6
test/Table_Tests are passing now
JaroslavTulach May 30, 2023
f5c365b
Report union types using Enso syntax
JaroslavTulach May 30, 2023
89a5150
Make sure error messages contain name of variables
JaroslavTulach May 30, 2023
d4f55bc
Revering back 9ad5d54 until opt-out | Any is removed from Filter_Cond…
JaroslavTulach May 30, 2023
d568ab3
Not in change log
JaroslavTulach May 30, 2023
2dbcd7a
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Ascrib…
JaroslavTulach May 30, 2023
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@
- [Suggestions are updated only when the type of the expression changes][6755]
- [Add project creation time to project metadata][6780]
- [Upgrade GraalVM to 22.3.1 JDK17][6750]
- [Ascribed types are checked during runtime][6790]

[3227]: https://github.com/enso-org/enso/pull/3227
[3248]: https://github.com/enso-org/enso/pull/3248
Expand Down Expand Up @@ -908,6 +909,7 @@
[6750]: https://github.com/enso-org/enso/pull/6750
[6755]: https://github.com/enso-org/enso/pull/6755
[6780]: https://github.com/enso-org/enso/pull/6780
[6790]: https://github.com/enso-org/enso/pull/6790

# Enso 2.0.0-alpha.18 (2021-10-12)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ type Filter_Condition
It accepts a Text value to check if the value contains it. In case of
Table operations, it can accept another column - then the corresponding
values from the source column and the provided column are checked.
Starts_With (prefix:Text) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)
Starts_With (prefix : Text | Any) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)

## Does the value end with a suffix (Text only)?

? Table Operations
It accepts a Text value to check if the value contains it. In case of
Table operations, it can accept another column - then the corresponding
values from the source column and the provided column are checked.
Ends_With (suffix:Text) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)
Ends_With (suffix : Text | Any) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)

## Does the value contain the substring (Text only)?

? Table Operations
It accepts a Text value to check if the value contains it. In case of
Table operations, it can accept another column - then the corresponding
values from the source column and the provided column are checked.
Contains (substring:Text) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)
Contains (substring : Text | Any) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)

## Is the substring not present in the value (Text only)?

? Table Operations
It accepts a Text value to check if the value contains it. In case of
Table operations, it can accept another column - then the corresponding
values from the source column and the provided column are checked.
Not_Contains (substring:Text) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)
Not_Contains (substring : Text | Any) (case_sensitivity:Case_Sensitivity=Case_Sensitivity.Default)

## Is equal to Nothing?
Is_Nothing
Expand Down Expand Up @@ -107,7 +107,7 @@ type Filter_Condition
Due to this limitation, Unicode normalization has been disabled for
this function, so beware that some equivalent graphemes like 'ś' and
's\u0301' will not be matched.
Like pattern:Text
Like (pattern : Text | Any)

## Does the value not match the SQL pattern (Text only)?

Expand All @@ -126,7 +126,7 @@ type Filter_Condition
Due to this limitation, Unicode normalization has been disabled for
this function, so beware that some equivalent graphemes like 'ś' and
's\u0301' will not be matched.
Not_Like pattern:Text
Not_Like pattern:Text|Any

## Is the value contained in `values`?

Expand All @@ -140,7 +140,7 @@ type Filter_Condition
Using Columns can be particularly useful for Database operations, as
uploading a temporary table and using its column for an `Is_In` check
will likely be faster than using the vector directly.
Is_In values:Vector
Is_In values:Vector|Any

## Is the value not contained in `values`?

Expand All @@ -154,7 +154,7 @@ type Filter_Condition
Using Columns can be particularly useful for Database operations, as
uploading a temporary table and using its column for an `Not_In` check
will likely be faster than using the vector directly.
Not_In values:Vector
Not_In values:(Vector | Any)

## Converts a `Filter_Condition` condition into a predicate taking an
element and returning a value indicating whether the element should be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type File_Error

## Indicates that the given type cannot be serialized to the provided file
format.
Unsupported_Output_Type (format : File_Format | File) (data_type : Any)
Unsupported_Output_Type (format : File_Format | File | Any) (data_type : Any)

## Indicates that the given file is corrupted, i.e. the data it contains
is not in the expected format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Column
which they come. Combined expressions must come from the same context -
they must both have the same filtering, grouping etc. rules applied to be
able to be combined.
Value name:Text connection:Connection sql_type_reference:SQL_Type_Reference expression:SQL_Expression context:Context
Value name:Text connection:(Connection | Any) sql_type_reference:SQL_Type_Reference expression:SQL_Expression context:Context

## PRIVATE
ADVANCED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type Table
- connection: The connection with which the table is associated.
- internal_columns: The internal representation of the table columns.
- context: The context associated with this table.
Value name:Text connection:Connection (internal_columns:(Vector Internal_Column)) context:Context
Value name:Text connection:(Connection | Any) (internal_columns:(Vector Internal_Column)) context:Context

## PRIVATE
ADVANCED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Query
`primary_key` actually exist in `columns`, as otherwise the behavior is
undefined (most likely will result in an `SQL_Error` once executed).
- temporary: specifies if the table should be marked as temporary.
Create_Table (table_name:Text) (columns : Vector (Pair Text Text)) (primary_key : Vector Text) (temporary : Boolean)
Create_Table (table_name:Text) (columns : Vector (Pair Text Text)) (primary_key : Nothing | Vector Text) (temporary : Boolean)

## PRIVATE
An SQL query that drops a table.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from Standard.Base import all

import project.Data.Column.Column
import project.Data.Column_Selector.Column_Selector
import project.Data.Sort_Column.Sort_Column

Expand All @@ -11,7 +12,7 @@ type Aggregate_Column
- column: the column (specified by name, expression or index) to group
by.
- new_name: name of new column.
Group_By (column:Text|Integer) (new_name:Text|Nothing=Nothing)
Group_By (column:Text|Integer|Column|Any) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the row count of each group. If no rows,
evaluates to 0.
Expand All @@ -31,7 +32,7 @@ type Aggregate_Column
multiple selection.
- new_name: name of new column.
- ignore_nothing: if all values are Nothing won't be included.
Count_Distinct (columns:(Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector))=0) (new_name:Text|Nothing=Nothing) (ignore_nothing:Boolean=False)
Count_Distinct (columns:(Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector | Column))=0) (new_name:Text|Nothing=Nothing) (ignore_nothing:Boolean=False) # Column needed because of 6866

## ALIAS Count_Not_Null

Expand All @@ -41,7 +42,7 @@ type Aggregate_Column
Arguments:
- column: the column (specified by name, expression or index) to count.
- new_name: name of new column.
Count_Not_Nothing (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Count_Not_Nothing (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## ALIAS Count_Null, Count_Missing

Expand All @@ -51,39 +52,39 @@ type Aggregate_Column
Arguments:
- column: the column (specified by name, expression or index) to count.
- new_name: name of new column.
Count_Nothing (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Count_Nothing (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the count of not `Nothing` (null) and non-empty
("") values of the column within each group. If no rows, evaluates to 0.

Arguments:
- column: the column (specified by name, expression or index) to count.
- new_name: name of new column.
Count_Not_Empty (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Count_Not_Empty (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the count of `Nothing` (null) or empty ("")
text values of the column within each group. If no rows, evaluates to 0.

Arguments:
- column: the column (specified by name, expression or index) to count.
- new_name: name of new column.
Count_Empty (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Count_Empty (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the sum of values (ignoring missing values) of
the column within each group. If no rows, evaluates to `Nothing`.

Arguments:
- column: the column (specified by name, expression or index) to total.
- new_name: name of new column.
Sum (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Sum (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the mean of values (ignoring missing values) of
the column within each group. If no rows, evaluates to `Nothing`.

Arguments:
- column: the column (specified by name, expression or index) to average.
- new_name: name of new column.
Average (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Average (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the median of values (ignoring missing values)
of the column within each group. If no rows, evaluates to `Nothing`.
Expand All @@ -92,7 +93,7 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to calculate
median on.
- new_name: name of new column.
Median (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Median (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the median of values (ignoring missing values)
of the column within each group. If no rows, evaluates to `Nothing`.
Expand All @@ -102,7 +103,7 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to compute
percentile.
- new_name: name of new column.
Percentile (percentile:Decimal=0.5) (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Percentile (percentile:Number=0.5) (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the mode of values (ignoring missing values)
of the column within each group. If no rows, evaluates to `Nothing`.
Expand All @@ -111,7 +112,7 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to find the
most common value.
- new_name: name of new column.
Mode (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Mode (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the standard deviation of values (ignoring
missing values) of the column within each group. If no rows, evaluates to
Expand All @@ -122,7 +123,7 @@ type Aggregate_Column
standard deviation.
- new_name: name of new column.
- population: specifies if group is a sample or the population
Standard_Deviation (column:Text|Integer=0) (new_name:Text|Nothing=Nothing) (population:Boolean=False)
Standard_Deviation (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) (population:Boolean=False) # Column needed because of 6866

## Creates a new column with the values concatenated together. `Nothing`
values will become an empty string. If no rows, evaluates to `Nothing`.
Expand All @@ -135,7 +136,7 @@ type Aggregate_Column
- suffix: added at the end of the result.
- quote_char: character used to quote the values if the value is `Empty`
or contains the separator.
Concatenate (column:Text|Integer=0) (new_name:Text|Nothing=Nothing) (separator:Text="") (prefix:Text="") (suffix:Text="") (quote_char:Text="")
Concatenate (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) (separator:Text="") (prefix:Text="") (suffix:Text="") (quote_char:Text="") # Column needed because of 6866

## Creates a new column with the first value in each group. If no rows,
evaluates to `Nothing`.
Expand All @@ -148,7 +149,7 @@ type Aggregate_Column
not missing value returned.
- order_by: required for database tables. Specifies how to order the
results within the group.
First (column:Text|Integer=0) (new_name:Text|Nothing=Nothing) (ignore_nothing:Boolean=True) (order_by:(Text | Sort_Column | Vector (Text | Sort_Column) | Nothing)=Nothing)
First (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) (ignore_nothing:Boolean=True) (order_by:(Text | Sort_Column | Vector (Text | Sort_Column) | Nothing)=Nothing) # Column needed because of 6866

## Creates a new column with the last value in each group. If no rows,
evaluates to `Nothing`.
Expand All @@ -161,7 +162,7 @@ type Aggregate_Column
not missing value returned.
- order_by: required for database tables. Specifies how to order the
results within the group.
Last (column:Text|Integer=0) (new_name:Text|Nothing=Nothing) (ignore_nothing:Boolean=True) (order_by:(Text | Sort_Column | Vector (Text | Sort_Column) | Nothing)=Nothing)
Last (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) (ignore_nothing:Boolean=True) (order_by:(Text | Sort_Column | Vector (Text | Sort_Column) | Nothing)=Nothing) # Column needed because of 6866

## Creates a new column with the maximum value in each group. If no rows,
evaluates to `Nothing`.
Expand All @@ -170,7 +171,7 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to find the
group maximum.
- new_name: name of new column.
Maximum (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Maximum (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the maximum value in each group. If no rows,
evaluates to `Nothing`.
Expand All @@ -179,7 +180,7 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to find the
group minimum.
- new_name: name of new column.
Minimum (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Minimum (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the shortest text in each group. If no rows,
evaluates to `Nothing`.
Expand All @@ -188,7 +189,7 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to find the
group shortest value.
- new_name: name of new column.
Shortest (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Shortest (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866

## Creates a new column with the longest text in each group. If no rows,
evaluates to `Nothing`.
Expand All @@ -197,4 +198,4 @@ type Aggregate_Column
- column: column (specified by name, expression or index) to find the
group longest value.
- new_name: name of new column.
Longest (column:Text|Integer=0) (new_name:Text|Nothing=Nothing)
Longest (column:Text|Integer|Column|Any=0) (new_name:Text|Nothing=Nothing) # Column needed because of 6866
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Delimited_Format
character if it anywhere else than at the beginning of the line. This
option is only applicable for read mode and does not affect writing. It
defaults to `Nothing` which means that comments are disabled.
Delimited (delimiter:Text=',') (encoding:Encoding=Encoding.utf_8) (skip_rows:Integer=0) (row_limit:Integer|Nothing=Nothing) (quote_style:Quote_Style=Quote_Style.With_Quotes) (headers:Boolean|Infer=Infer) (value_formatter:Data_Formatter|Nothing=Data_Formatter.Value) (keep_invalid_rows:Boolean=True) (line_endings:Line_Ending_Style=Infer) (comment_character:Text|Nothing=Nothing)
Delimited (delimiter:Text=',') (encoding:Encoding=Encoding.utf_8) (skip_rows:Integer=0) (row_limit:Integer|Nothing=Nothing) (quote_style:Quote_Style=Quote_Style.With_Quotes) (headers:Boolean|Infer=Infer) (value_formatter:Data_Formatter|Nothing=Data_Formatter.Value) (keep_invalid_rows:Boolean=True) (line_endings:Line_Ending_Style|Infer=Infer) (comment_character:Text|Nothing=Nothing)

## PRIVATE
ADVANCED
Expand Down
6 changes: 3 additions & 3 deletions distribution/lib/Standard/Table/0.0.0-dev/src/Errors.enso
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type Unquoted_Characters_In_Output
## Indicates that a specified location was not valid.
type Invalid_Location
## PRIVATE
Error (location:Text)
Error (location : Text | Any)

## PRIVATE
Pretty print the invalid location error.
Expand All @@ -259,7 +259,7 @@ type Invalid_Location
format.
type Invalid_Format
## PRIVATE
Error column:(Text|Nothing) (value_type:Value_Type|Integer|Number|Date|Date_Time|Time_Of_Day|Boolean) (cells:[Text])
Error column:(Text|Nothing) (value_type:Value_Type|Integer|Number|Date|Date_Time|Time_Of_Day|Boolean|Any) (cells:[Text])

## PRIVATE
Pretty print the invalid format error.
Expand Down Expand Up @@ -448,7 +448,7 @@ type Invalid_JSON_Format
type Column_Type_Mismatch
## PRIVATE
An error indicating a mismatch of column types of merged columns.
Error (column_name : Text) (expected_type : Text) (got_type : Text)
Error (column_name : Text) (expected_type : Text | Any) (got_type : Text | Any)

## PRIVATE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ type Detected_File_Metadata
- ends_with_newline: specifies if the last line ends with a line
separator that is consistent with the detected one.
- has_any_content: specifies if the file contains any content.
Value (headers : Detected_Headers) (line_separator : Text|Nothing) (ends_with_newline : Boolean) (has_any_content : Boolean)
Value (headers : Detected_Headers | Nothing) (line_separator : Text|Nothing) (ends_with_newline : Boolean) (has_any_content : Boolean)

## PRIVATE
Reads the beginning of the file to detect the existing headers and column
Expand Down
Loading