Commit graph

936 commits

Author SHA1 Message Date
Mostly Void
d6a54710d6
Fix Str.splitLast
This fixes the behavior of the function when the needle is positioned
last in the haystack.

» Str.splitLast "ehllo,," ",,"

Ok { after: "", before: "ehllo" } : Result { after : Str, before : Str } [NotFound]*
2022-08-03 11:30:49 +05:30
Ayaz
f72d29d6c5
Merge pull request #3660 from rtfeldman/i3653
Unify material recursion variables behind aliases and opaques
2022-07-29 18:35:44 -05:00
Ayaz
ad63acdc48
Merge pull request #3663 from rtfeldman/type-var-name-hints
Allow naming type variables with a basis hint
2022-07-29 18:35:29 -05:00
Ayaz
fffe9ca8ee
Merge pull request #3659 from rtfeldman/when-on-128bit-numbers
when on 128-bit numbers
2022-07-29 14:54:16 -05:00
Ayaz
ff0edc72c3
Merge pull request #3657 from rtfeldman/when-on-strings
implement when on multiple string patterns
2022-07-29 14:53:35 -05:00
Ayaz Hafiz
02d5d0ec92
Allow naming type variables with a basis hint
I think this makes it easier to read type variables when they come from
flex/rigid vars with pre-existing names, just give them a number suffix
to differentiate them.
2022-07-29 15:32:44 -04:00
Anton-4
668fa3ef49
Merge pull request #3645 from rtfeldman/use-bitwise-or-instead-of-addition
Replace addition with bitwise or
2022-07-29 19:52:55 +02:00
Ayaz Hafiz
c397f7a0d9
Turn off failing test for now 2022-07-29 11:09:10 -04:00
Ayaz Hafiz
1460f60ab1
Unify material recursion variables behind aliases and opaques
Even if there are no changes to alias arguments, and no new variables were
introduced, we may still need to unify the "actual types" of the alias or opaque!

The unification is not necessary from a types perspective (and in fact, we may want
to disable it for `roc check` later on), but it is necessary for the monomorphizer,
which expects identical types to be reflected in the same variable.

As a concrete example, consider the unification of two opaques

  P := [Zero, Succ P]

  (@P (Succ n)) ~ (@P (Succ o))

`P` has no arguments, and unification of the surface of `P` introduces nothing new.
But if we do not unify the types of `n` and `o`, which are recursion variables, they
will remain disjoint! Currently, the implication of this is that they will be seen
to have separate recursive memory layouts in the monomorphizer - which is no good
for our compilation model.

Closes #3653
2022-07-29 11:03:47 -04:00
Brian Carroll
94ccfc30a3
Merge pull request #3658 from rtfeldman/wasm-fix-shiftRightBy
wasm: Fix shiftRightBy for U8 and U16
2022-07-29 15:22:15 +02:00
Folkert
d90fbbb032
remove duplicate test 2022-07-29 14:42:26 +02:00
Christoph Rüßler
ee4c62473e
Replace addition with bitwise or 2022-07-29 14:26:29 +02:00
Folkert
47bbef30e8
when on 128-bit numbers 2022-07-29 14:09:50 +02:00
Brian Carroll
0041d4f3bc
wasm: Fix shiftRightBy for U8 and U16 2022-07-29 14:05:39 +02:00
Folkert
d0f1500dad
implement when on multiple string patterns 2022-07-29 12:13:21 +02:00
Ayaz Hafiz
c0e976f544
Wrap unification subs in Env 2022-07-28 08:57:33 -04:00
Ayaz Hafiz
0989b2cb82
Move solve problems to their own crate 2022-07-28 08:57:32 -04:00
Ayaz Hafiz
ae4916ceb7
Remove unused variables 2022-07-28 08:57:14 -04:00
Ayaz Hafiz
753d12e912
Eagerly resolve obligations during solving
Replaces the previously-used `DeferredObligations` structure used for
accumulating and then acting over ability obligations during module
solving in favor of just the `ObligationCache`. The `ObligationCache`
stays alive for the entirety of a module solving and provides a
convenient mechanism for answering obligation queries with a backed
cache.
2022-07-28 08:57:13 -04:00
Folkert de Vries
01eb161ffe
Merge pull request #3637 from rtfeldman/can-abilities4
Syntactic abilities: Part 4 - simplify obligation solving procedure
2022-07-28 11:32:11 +02:00
Folkert de Vries
66365fba6e
Merge pull request #3649 from rtfeldman/3640-str-split-edge-case
Fix `Str.split` edge case when string and delimiter are equal
2022-07-28 11:30:40 +02:00
Folkert de Vries
21fe0ca559
Merge pull request #3639 from rtfeldman/expect-lists
Tests for expect output
2022-07-28 08:53:58 +02:00
raleng
c7997c7c38
Fix formatting 2022-07-28 01:57:01 +02:00
raleng
17fc1a297c
Fix Str.split when string equals delimiter
countSegments and strSplitHelp check whether the length of the string is
strictly greater-than the length of the delimiter, skipping most of the
logic when this is not the case.

Changing the check to a greater-than-or-equal allows for the case when
the string and the delimiter are equal, giving the expected result of
["", ""].
2022-07-28 01:36:02 +02:00
raleng
71e83746cc
add countSegments test case
The test ensures countSegments returns a count of two when the string
and the delimiter are equal. The expected result of Str.split in that
case is ["", ""].
2022-07-28 01:35:08 +02:00
raleng
261ff3224d
Add strSplitHelp test cases
Add a test for the case when the string starts with the delimiter, and
when the string and the delimiter are equal.
2022-07-28 01:34:20 +02:00
Folkert
8e5b0daa94
figured out how to serialize nested structures 2022-07-27 23:52:11 +02:00
Folkert
fc01a0ee44
ignore if set_shared_buffer is not defined 2022-07-27 23:50:06 +02:00
Folkert
e62a0ee39a
make string clone return where next extra bytes should be written 2022-07-27 22:48:41 +02:00
Folkert
631c642950
store the start of the value for each variable in a table 2022-07-27 21:32:49 +02:00
Folkert
9bdf1f733f
Wasm32Sized for isize 2022-07-27 20:10:47 +02:00
Folkert
da74585786
switch to load/store instead of phi because of weird bug 2022-07-27 19:27:55 +02:00
Folkert
f7452b8889
pass the shared buffer to zig directly 2022-07-27 17:16:12 +02:00
Folkert
a60a49bce6
dev backend cannot compare floats 2022-07-27 14:46:46 +02:00
Folkert
b132b1fa89
fix non-recursive tag unions in expects 2022-07-27 14:44:43 +02:00
Folkert
b24c9e33d7
make test_gen a package 2022-07-27 13:49:23 +02:00
Folkert
498004c554
clean up expect code when not running tests 2022-07-27 12:26:03 +02:00
Folkert
eefb23e433
DCE expect helper for non-expect code gen 2022-07-27 12:07:51 +02:00
Richard Feldman
fa5bd442f8
Merge pull request #3635 from rtfeldman/joshuawarner32/multiline
Strip indents and the first/last newline from multiline strings
2022-07-26 22:09:58 -04:00
Ayaz Hafiz
bb14b649a2
Don't re-report obligations that we know were seen elsewhere 2022-07-26 20:46:35 -04:00
Ayaz Hafiz
6b9c1cb690
Check whether opaque implements ability using store 2022-07-26 20:46:35 -04:00
Ayaz Hafiz
8659ddc684
Remove dominated derive errors 2022-07-26 20:46:35 -04:00
Ayaz Hafiz
3fbf4e228b
Remove dominated derives from obligation checking 2022-07-26 20:46:34 -04:00
Ayaz Hafiz
ad3eb959e9
Don't mark dominated derives anymore 2022-07-26 20:46:34 -04:00
Ayaz Hafiz
04ee74542d
Rename IncompleteAbility 2022-07-26 20:46:34 -04:00
Ayaz Hafiz
c0d26226dd
Remove deferred obligation for opaques during solving 2022-07-26 20:46:34 -04:00
Ayaz Hafiz
c1dbffdad9
Make sure wrong specializations become error types 2022-07-26 20:46:34 -04:00
Ayaz Hafiz
3703940da9
Report specializations that target the unexpected type 2022-07-26 20:46:34 -04:00
Ayaz Hafiz
968bd468a8
Use proper members in checking derive keys 2022-07-26 20:46:33 -04:00
Ayaz Hafiz
f2cf7405df
Revert "Use abilities ImplKey in solve"
This reverts commit b7cb0003134f1b0c657d7173db6965b4247500aa.
2022-07-26 20:46:33 -04:00