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

Get rid of free-floating atoms. Everything has a type now! #3671

Merged
merged 114 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
fe10db6
better parsing of type sigs
kustosz May 5, 2022
084cdab
testing facilities
kustosz May 6, 2022
2d99f1a
resolution testing
kustosz May 6, 2022
1b3457b
plug in basic resolution
kustosz May 6, 2022
aeb2b28
resolution of imported atoms
kustosz May 6, 2022
8745762
make types exportable
kustosz May 6, 2022
683cd04
use sigs in suggestion builder
kustosz May 26, 2022
2997cdc
fix union types
kustosz May 27, 2022
a0cdbe3
fix the suggestion builder to use sum types
kustosz May 27, 2022
dde6c8c
write proper level tests for unions
kustosz May 27, 2022
6a83655
fix all tests
kustosz Jun 4, 2022
37ca55d
fix docs & tests
kustosz Jun 4, 2022
d4e7650
fix formatting
kustosz Jun 4, 2022
1237536
fmt & doc
kustosz Jun 4, 2022
e7bbb26
keep moving towards actual tycons
kustosz Jun 28, 2022
675fb78
mega awesome fix
kustosz Jun 29, 2022
abe1a4a
checkpoint
kustosz Jul 13, 2022
5a6d749
checkpoint
kustosz Jul 14, 2022
e3bbaaa
checkpoint
kustosz Jul 28, 2022
9310fc7
builtin dsl changes
kustosz Jul 29, 2022
2ce6fd2
keep fighting the compiler
kustosz Jul 29, 2022
ff0f6a0
holy cow it compiled
kustosz Jul 29, 2022
29f0bd0
actually have some tests pass!
kustosz Jul 29, 2022
7c54ab8
fix dataflow analysis
kustosz Aug 3, 2022
64fbd07
testing progress
kustosz Aug 3, 2022
c7a81ee
another undeniable success
kustosz Aug 3, 2022
6d95c4a
more painstaking fixing
kustosz Aug 3, 2022
f19c994
keep going, try not to cry
kustosz Aug 3, 2022
63b61f4
more progress
kustosz Aug 3, 2022
0d23124
keep em passing
kustosz Aug 3, 2022
6e5fa16
checkpoint
kustosz Aug 4, 2022
95b097f
Merge branch 'develop' into wip/mk/parse-types
kustosz Aug 4, 2022
5f06fda
post-merge fix
kustosz Aug 4, 2022
847fffa
error refactoring
kustosz Aug 4, 2022
8ad6bf5
fix more tests
kustosz Aug 4, 2022
184b54c
make the benchmarks compile
kustosz Aug 9, 2022
2092fd6
update benchmarks
kustosz Aug 9, 2022
30d8e6e
simplify dispatch
kustosz Aug 10, 2022
e46fbc3
fix all semantic tests
kustosz Aug 10, 2022
b4f4531
start fixing stdlib
kustosz Aug 10, 2022
30ecb0a
keep going
kustosz Aug 10, 2022
5f3475b
more
kustosz Aug 10, 2022
49c1282
Keep going. Actually help myself in the compiler
kustosz Aug 11, 2022
f3b4814
more progress, same amount of suffering
kustosz Aug 11, 2022
0043065
progress
kustosz Aug 11, 2022
2faceeb
keep going
kustosz Aug 12, 2022
c8052a7
first passing test
kustosz Aug 15, 2022
d53adc9
implement getters
kustosz Aug 15, 2022
d19bf5b
fix errors
kustosz Aug 15, 2022
6d9b65e
keep going
kustosz Aug 15, 2022
72da137
keep going
kustosz Aug 16, 2022
dbecbbe
progress
kustosz Aug 16, 2022
4730eee
progress
kustosz Aug 17, 2022
ca352cd
fix all of Base
kustosz Aug 17, 2022
fefdf7e
cleanup; move on to tables
kustosz Aug 17, 2022
fde9ec4
prog
kustosz Aug 17, 2022
cfbd607
first successes in table
kustosz Aug 18, 2022
875d02d
progress
kustosz Aug 18, 2022
4889661
keep going
kustosz Aug 23, 2022
26fc60c
another test
kustosz Aug 23, 2022
010abe4
progress
kustosz Aug 23, 2022
31066d5
more passing specs
kustosz Aug 23, 2022
cc29f18
more successes
kustosz Aug 23, 2022
b9f771c
rest of db specs
kustosz Aug 25, 2022
00283d1
image tests
kustosz Aug 25, 2022
2905f31
example tests
kustosz Aug 25, 2022
feb545c
geo tests
kustosz Aug 25, 2022
a8514fa
vis tests
kustosz Aug 25, 2022
e992f0c
progress on compiler specs
kustosz Aug 25, 2022
aef3e23
more compiler tests pass
kustosz Aug 25, 2022
c662f05
test progress
kustosz Aug 25, 2022
b969fdd
fix suggestion builder
kustosz Aug 25, 2022
072abaa
keep fixing tests
kustosz Aug 25, 2022
2be4b19
fix deserializing AA metadata
kustosz Aug 26, 2022
b0d573f
last of runtime tests
kustosz Aug 26, 2022
d44d321
fix runtime instrument, progress on tests
kustosz Aug 26, 2022
678ed84
all tests pass
kustosz Aug 26, 2022
d040c77
ALL tests
kustosz Aug 26, 2022
7d205f2
Merge branch 'develop' into wip/mk/parse-types
kustosz Aug 26, 2022
21fc962
fix all of Base once again, after merge....
kustosz Aug 26, 2022
aa73059
fix all of table again...
kustosz Aug 26, 2022
214081e
Update distribution/lib/Standard/Base/0.0.0-dev/src/Data/Any.enso
kustosz Aug 27, 2022
6578c3c
Merge remote-tracking branch 'origin/develop' into wip/mk/parse-types
kustosz Aug 29, 2022
cdbfe6a
another merge
kustosz Aug 29, 2022
0852efa
try a thingy
kustosz Aug 29, 2022
c1b22d4
atomic hack
kustosz Aug 29, 2022
4d78453
case?
kustosz Aug 29, 2022
05124b5
everybody is ci-fighting
kustosz Aug 29, 2022
50df2c9
fix postgres
kustosz Aug 29, 2022
eb8c6ec
fix geo tests
kustosz Aug 29, 2022
38ffadd
more fixes
kustosz Aug 29, 2022
7b82ac4
revert hackering
kustosz Aug 29, 2022
2eeac50
Merge branch 'develop' into wip/mk/parse-types
kustosz Aug 30, 2022
40cbb70
format it
kustosz Aug 30, 2022
552166f
changelog it
kustosz Aug 30, 2022
034b74f
some CR feedback;
kustosz Aug 30, 2022
06dc4e0
Update distribution/lib/Standard/Image/0.0.0-dev/src/Codecs.enso
kustosz Aug 30, 2022
a52c828
Update distribution/lib/Standard/Image/0.0.0-dev/src/Codecs.enso
kustosz Aug 30, 2022
48c8bd9
Update test/Table_Tests/src/Data_Formatter_Spec.enso
kustosz Aug 30, 2022
8ecf7a1
Update test/Table_Tests/src/Data_Formatter_Spec.enso
kustosz Aug 30, 2022
4d9958a
Update test/Table_Tests/src/Data_Formatter_Spec.enso
kustosz Aug 30, 2022
ec17e7f
Update test/Table_Tests/src/Excel_Spec.enso
kustosz Aug 30, 2022
9cfe2b0
Update test/Tests/src/Semantic/Names_Spec.enso
kustosz Aug 30, 2022
9a84217
stuff
kustosz Aug 30, 2022
65e2582
.
kustosz Aug 30, 2022
fdf06a9
Update distribution/lib/Standard/Image/0.0.0-dev/src/Codecs.enso
kustosz Aug 30, 2022
c91dc45
Update distribution/lib/Standard/Image/0.0.0-dev/src/Codecs.enso
kustosz Aug 30, 2022
83060ef
Update test/Table_Tests/src/Excel_Spec.enso
kustosz Aug 30, 2022
3ebf4a8
Update test/Tests/src/Data/Text_Spec.enso
kustosz Aug 30, 2022
1bf52b8
continue
kustosz Aug 30, 2022
8ff4f9e
fmt
kustosz Aug 30, 2022
f733104
fix tests
kustosz Aug 30, 2022
c73fea5
fmt
kustosz Aug 30, 2022
2ee29c0
missing foc
kustosz Aug 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 10 additions & 13 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Any.enso
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ from Standard.Base import all

from Standard.Base.Error.Common import dataflow_error_handler

# The type that subsumes all types.
type Any

## Any is the universal top-type, with all other types being subsumed by it.
## Any is the universal top-type, with all other types being subsumed by it.

If a value of type Any is expected in a given location, _any value_ can
be used in that position.
@Builtin_Type
type Any
If a value of type Any is expected in a given location, _any value_ can
be used in that position.
@Builtin_Type
type Any

## PRIVATE

Expand Down Expand Up @@ -78,19 +75,19 @@ type Any
== self that = if Meta.is_same_object self that then True else
self_meta = Meta.meta self
that_meta = Meta.meta that
case Cons self_meta that_meta of
Cons (Meta.Atom _) (Meta.Atom _) ->
case Pair_Data self_meta that_meta of
Pair_Data (Meta.Atom_Data _) (Meta.Atom_Data _) ->
c_1 = self_meta.constructor
c_2 = that_meta.constructor
if Meta.is_same_object c_1 c_2 . not then False else
f_1 = self_meta.fields
f_2 = that_meta.fields
0.up_to f_1.length . all i-> (f_1.at i) == (f_2.at i)
Cons (Meta.Error _) (Meta.Error _) -> self_meta.payload == that_meta.payload
Cons (Meta.Polyglot o_1) (Meta.Polyglot o_2) ->
Pair_Data (Meta.Error_Data _) (Meta.Error_Data _) -> self_meta.payload == that_meta.payload
Pair_Data (Meta.Polyglot_Data o_1) (Meta.Polyglot_Data o_2) ->
langs_match = (self_meta.get_language == Meta.Java) && (that_meta.get_language == Meta.Java)
if langs_match.not then False else o_1.equals o_2
Cons (Meta.Unresolved_Symbol _) (Meta.Unresolved_Symbol _) ->
Pair_Data (Meta.Unresolved_Symbol_Data _) (Meta.Unresolved_Symbol_Data _) ->
(self_meta.name == that_meta.name) && (self_meta.scope == that_meta.scope)
## Constructor comparison is covered by the identity equality.
Primitive objects should define their own equality.
Expand Down
10 changes: 3 additions & 7 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import Standard.Base.Data.Vector

## Utilities for working with primitive arrays.
## The type of primitive mutable arrays.
@Builtin_Type
type Array

## The type of primitive mutable arrays.
@Builtin_Type
type Array

## Gets the element at index in the array this.

Arguments:
Expand Down Expand Up @@ -68,7 +64,7 @@ type Array
[1, 2, 3, 4].to_array.to_default_visualization_data
to_default_visualization_data : Text
to_default_visualization_data self =
Vector.Vector self . to_default_visualization_data
Vector.Vector_Data self . to_default_visualization_data

## Creates an array with length 0.

Expand Down
23 changes: 7 additions & 16 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Boolean.enso
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
## Booleans.
type Boolean

## A type with only two possible values.
## A type with only two possible values.

The boolean type represents the two truth values of boolean logic. It is
primarily used for control-flow.
@Builtin_Type
type Boolean
The boolean type represents the two truth values of boolean logic. It is
primarily used for control-flow.
@Builtin_Type
type Boolean
True
False

## Compares two booleans for equality.

Expand Down Expand Up @@ -106,11 +105,3 @@ type Boolean
if (27 % 3) == 0 then IO.println "Fizz"
if_then : Any -> Any | Nothing
if_then self ~on_true = @Builtin_Method "Boolean.if_then"

## The constructor for the value True.
@Builtin_Type
type True

## The constructor for the value False.
@Builtin_Type
type False
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ type Index_Sub_Range

Selects no items if `count` is less than or equal to 0.
Selects all items if `count` is greater than the length of the input.
type First (count : Integer = 1)
First (count : Integer = 1)

## Select the last `count` characters.

Selects no items if `count` is less than or equal to 0.
Selects all items if `count` is greater than the length of the input.
type Last (count : Integer = 1)
Last (count : Integer = 1)

## Select elements from the start while the predicate returns `True`.
type While (predicate : (Any -> Boolean))
While (predicate : (Any -> Boolean))

## Selects specific indexes (starting from 0) either as an `Integer` or a
`Range`.
Expand All @@ -29,21 +29,21 @@ type Index_Sub_Range
Only ranges with positive step and positive indices are supported.
Individual integer indices can be negative which allows for indexing
from the end of the collection.
type By_Index (indexes : (Integer | Range | Vector (Integer | Range)) = [0])
By_Index (indexes : (Integer | Range | Vector (Integer | Range)) = [0])

## Gets a random sample of entries, without repetitions.

If `count` is greater than the length of the input, a random permutation
of all elements from the input is selected.
type Sample (count:Integer) (seed:Integer=Random.get_default_seed)
Sample (count:Integer) (seed:Integer=Random.get_default_seed)

## Gets every Nth entry.

Arguments:
- step: The step between consecutive entries that are included.
- first: The first entry to include. If it is outside of bounds of the
input, an error is raised.
type Every (step:Integer) (first:Integer=0)
Every (step:Integer) (first:Integer=0)

## PRIVATE
Resolves a vector of ranges or indices into a vector of ranges that fit
Expand All @@ -55,15 +55,15 @@ resolve_ranges ranges length =
trim descriptor = case descriptor of
Integer ->
actual_index = if descriptor < 0 then length + descriptor else descriptor
if (actual_index < 0) || (actual_index >= length) then Panic.throw (Index_Out_Of_Bounds_Error descriptor length) else
if (actual_index < 0) || (actual_index >= length) then Panic.throw (Index_Out_Of_Bounds_Error_Data descriptor length) else
kustosz marked this conversation as resolved.
Show resolved Hide resolved
actual_index
Range start end step ->
if step <= 0 then Panic.throw (Illegal_Argument_Error "Range step must be positive.") else
if (start < 0) || (end < 0) then Panic.throw (Illegal_Argument_Error "Range start and end must not be negative.") else
if start >= length then Panic.throw (Index_Out_Of_Bounds_Error start length) else
Range_Data start end step ->
if step <= 0 then Panic.throw (Illegal_Argument_Error_Data "Range step must be positive.") else
if (start < 0) || (end < 0) then Panic.throw (Illegal_Argument_Error_Data "Range start and end must not be negative.") else
if start >= length then Panic.throw (Index_Out_Of_Bounds_Error_Data start length) else
actual_end = Math.min end length
if actual_end < start then Range start start step else
Range start actual_end step
if actual_end < start then Range_Data start start step else
Range_Data start actual_end step
ranges.map trim

## PRIVATE
Expand All @@ -73,11 +73,11 @@ resolve_ranges ranges length =
single-element ranges.
normalize_ranges descriptors =
normalize descriptor = case descriptor of
Integer -> [Range descriptor descriptor+1]
Range _ _ _ ->
Integer -> [Range_Data descriptor descriptor+1]
Range_Data _ _ _ ->
if descriptor.step == 1 then [descriptor] else
descriptor.to_vector.map ix->
Range ix ix+1
Range_Data ix ix+1
descriptors.flat_map normalize

## PRIVATE
Expand All @@ -96,9 +96,9 @@ normalize_ranges descriptors =
invert_range_selection : Vector Range -> Integer -> Boolean -> Vector Range
invert_range_selection ranges length needs_sorting =
sorted = if needs_sorting then sort_and_merge_ranges ranges else ranges
ranges_with_sentinels = [Range 0 0] + sorted + [Range length length]
ranges_with_sentinels = [Range_Data 0 0] + sorted + [Range_Data length length]
ranges_with_sentinels.zip ranges_with_sentinels.tail prev-> next->
Range prev.end next.start
Range_Data prev.end next.start

## PRIVATE
Returns a new sorted list of ranges where intersecting ranges have been
Expand All @@ -113,7 +113,7 @@ sort_and_merge_ranges ranges =
sorted.tail.each range->
current = current_ref.get
case range.start <= current.end of
True -> current_ref.put (Range current.start (Math.max current.end range.end))
True -> current_ref.put (Range_Data current.start (Math.max current.end range.end))
False ->
builder.append current
current_ref.put range
Expand Down Expand Up @@ -147,16 +147,16 @@ sort_and_merge_ranges ranges =
- range: The `Index_Sub_Range` to take from the collection.
take_helper : Integer -> (Integer -> Any) -> (Integer -> Integer -> Any) -> (Vector (Integer | Range) -> Vector Any) -> Index_Sub_Range -> Any
take_helper length at single_slice slice_ranges index_sub_range = case index_sub_range of
Range _ _ _ -> take_helper length at single_slice slice_ranges (By_Index index_sub_range)
Range_Data _ _ _ -> take_helper length at single_slice slice_ranges (By_Index index_sub_range)
First count -> single_slice 0 (Math.min length count)
Last count -> single_slice length-count length
While predicate ->
end = 0.up_to length . find i-> (predicate (at i)).not
true_end = if end.is_nothing then length else end
single_slice 0 true_end
By_Index one_or_many_descriptors -> Panic.recover [Index_Out_Of_Bounds_Error, Illegal_Argument_Error] <|
By_Index one_or_many_descriptors -> Panic.recover [Index_Out_Of_Bounds_Error_Data, Illegal_Argument_Error_Data] <|
indices = case one_or_many_descriptors of
Vector.Vector _ -> one_or_many_descriptors
Vector.Vector_Data _ -> one_or_many_descriptors
_ -> [one_or_many_descriptors]
trimmed = resolve_ranges indices length
slice_ranges trimmed
Expand All @@ -165,9 +165,9 @@ take_helper length at single_slice slice_ranges index_sub_range = case index_sub
indices_to_take = Random.random_indices length count rng
take_helper length at single_slice slice_ranges (By_Index indices_to_take)
Every step start ->
if step <= 0 then Error.throw (Illegal_Argument_Error "Step within Every must be positive.") else
if step <= 0 then Error.throw (Illegal_Argument_Error_Data "Step within Every must be positive.") else
if start >= length then single_slice 0 0 else
range = Range start length step
range = Range_Data start length step
take_helper length at single_slice slice_ranges (By_Index range)

## PRIVATE
Expand Down Expand Up @@ -196,16 +196,16 @@ take_helper length at single_slice slice_ranges index_sub_range = case index_sub
- range: The `Index_Sub_Range` to drop from the collection.
drop_helper : Integer -> (Integer -> Any) -> (Integer -> Integer -> Any) -> (Vector (Integer | Range) -> Vector Any) -> Index_Sub_Range -> Any
drop_helper length at single_slice slice_ranges index_sub_range = case index_sub_range of
Range _ _ _ -> drop_helper length at single_slice slice_ranges (By_Index index_sub_range)
Range_Data _ _ _ -> drop_helper length at single_slice slice_ranges (By_Index index_sub_range)
First count -> single_slice count length
Last count -> single_slice 0 length-count
While predicate ->
end = 0.up_to length . find i-> (predicate (at i)).not
true_end = if end.is_nothing then length else end
single_slice true_end length
By_Index one_or_many_descriptors -> Panic.recover [Index_Out_Of_Bounds_Error, Illegal_Argument_Error] <|
By_Index one_or_many_descriptors -> Panic.recover [Index_Out_Of_Bounds_Error_Data, Illegal_Argument_Error_Data] <|
indices = case one_or_many_descriptors of
Vector.Vector _ -> one_or_many_descriptors
Vector.Vector_Data _ -> one_or_many_descriptors
_ -> [one_or_many_descriptors]
trimmed = resolve_ranges indices length
normalized = normalize_ranges trimmed
Expand All @@ -216,7 +216,7 @@ drop_helper length at single_slice slice_ranges index_sub_range = case index_sub
indices_to_drop = Random.random_indices length count rng
drop_helper length at single_slice slice_ranges (By_Index indices_to_drop)
Every step start ->
if step <= 0 then Error.throw (Illegal_Argument_Error "Step within Every must be positive.") else
if step <= 0 then Error.throw (Illegal_Argument_Error_Data "Step within Every must be positive.") else
if start >= length then single_slice 0 length else
range = Range start length step
range = Range_Data start length step
drop_helper length at single_slice slice_ranges (By_Index range)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export Standard.Base.Data.Interval.Bound

example_exclusive = Interval.exclusive 0.1 0.5
exclusive : Number -> Number -> Interval
exclusive start end = Interval (Bound.Exclusive start) (Bound.Exclusive end)
exclusive start end = Interval_Data (Bound.Exclusive start) (Bound.Exclusive end)

## Creates an interval that excludes its lower bound.

Expand All @@ -24,7 +24,7 @@ exclusive start end = Interval (Bound.Exclusive start) (Bound.Exclusive end)

example_start_exclusive = Interval.start_exclusive 1 5
start_exclusive : Number -> Number -> Interval
start_exclusive start end = Interval (Bound.Exclusive start) (Bound.Inclusive end)
start_exclusive start end = Interval_Data (Bound.Exclusive start) (Bound.Inclusive end)

## Creates an interval that excludes its upper bound.

Expand All @@ -35,7 +35,7 @@ start_exclusive start end = Interval (Bound.Exclusive start) (Bound.Inclusive en

example_end_exclusive = Interval.end_exclusive 1 5
end_exclusive : Number -> Number -> Interval
end_exclusive start end = Interval (Bound.Inclusive start) (Bound.Exclusive end)
end_exclusive start end = Interval_Data (Bound.Inclusive start) (Bound.Exclusive end)

## Creates an interval that includes both of its bounds.

Expand All @@ -46,7 +46,7 @@ end_exclusive start end = Interval (Bound.Inclusive start) (Bound.Exclusive end)

example_inclusive = Interval.inclusive 0 0
inclusive : Number -> Number -> Interval
inclusive start end = Interval (Bound.Inclusive start) (Bound.Inclusive end)
inclusive start end = Interval_Data (Bound.Inclusive start) (Bound.Inclusive end)

## A type representing an interval over real numbers.
type Interval
Expand All @@ -58,7 +58,7 @@ type Interval
Arguments:
- start: The start of the interval.
- end: The end of the interval.
type Interval (start : Number) (end : Number)
Interval_Data (start : Bound.Bound) (end : Bound.Bound)

## Checks if the interval contains `that`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Bound
import Standard.Base.Data.Interval.Bound

example_bound_inclusive = Bound.Inclusive 2
type Inclusive n
Inclusive n

## A bound that excludes the value `n`.

Expand All @@ -29,4 +29,4 @@ type Bound
import Standard.Base.Data.Interval.Bound

example_bound_exclusive = Bound.Exclusive 2.
type Exclusive n
Exclusive n
Loading