Commit graph

549 commits

Author SHA1 Message Date
Folkert
d1d7cfef44
reimplement Result 2022-02-23 17:52:13 +01:00
hafiz
ca9ecbea52
Merge pull request #2533 from rtfeldman/abilities!
[WIP] Spike for abilities and friends
2022-02-21 23:18:40 -05:00
Anton-4
985af24071
added reference to created issue for update_key 2022-02-21 17:20:19 +01:00
Anton-4
48d5775f62
simplification, stricter adherence to projectional editing approach 2022-02-21 14:47:57 +01:00
ayazhafiz
fa24e51593 Parse opaque types 2022-02-19 18:38:31 -05:00
ayazhafiz
13067f2908 Implement Num.toNNNChecked
Closes #2411
2022-02-19 16:20:21 -05:00
Jan Van Bruggen
e12d98af98 WIP: Start adding new Int.toInt builtins 2022-02-19 11:28:12 -05:00
Brian Carroll
c61a18a200 Use custom macros for static assertions 2022-02-09 17:16:43 +00:00
Brian Carroll
8e370a32b6 repl: update some static_asserts for 32-bit compiler build 2022-02-09 16:34:11 +00:00
Jan Van Bruggen
14ef9be3d2 Sort Num.(min/max)* builtin symbol defs 2022-01-22 00:19:17 -07:00
Jan Van Bruggen
9a8a4c6ed7 Add Num.(min/max)(I/U)(8/16) builtins 2022-01-22 00:19:17 -07:00
Eric Newbury
a96d5e6abf Merge branch 'trunk' into enewbury/list-sort-desc 2022-01-21 17:06:52 -05:00
Eric Newbury
7e7104d9ba WIP 2022-01-21 16:46:47 -05:00
Eric Newbury
05c01a81f5 adding List.sortAsc builtin 2022-01-21 15:34:24 -05:00
Richard Feldman
eacbb956cf
Merge pull request #2360 from rtfeldman/builtins-using-builtins
using builtins from builtins
2022-01-20 18:20:50 -05:00
Brian Hicks
f2ae02213a remove deprecated symbols and reorder remainder 2022-01-20 08:29:30 -06:00
Jan Van Bruggen
8e4b6f0cab Remove Num.(min/max)Int
Replace all uses with `Num.(min/max)I64`,
since all uses expect an `I64`.
2022-01-19 09:55:06 -07:00
Jan Van Bruggen
591477e77b Add most remaining Num.min/max* builtins
This skips `min/maxU128`, as they require a subtle change
to the `I128`-centric implementation of `Int`s.
2022-01-17 15:26:23 -07:00
Folkert
697a65e77c builtins can use builtins now 2022-01-16 22:28:36 +01:00
Jan Van Bruggen
d7e2be306f WIP: Add Num.minI128 builtin (TODOs remain) 2022-01-15 17:49:15 -07:00
ayazhafiz
2c41c43aea Implement saturated add/subtract 2022-01-10 22:37:08 -05:00
Anton-4
b9665a8f0c fixed precedence comment 2022-01-03 15:51:31 +01:00
Brian Carroll
6b932f9743 Clarify some lowlevel code to make it clearer what to do when adding new ones 2021-12-29 22:11:33 +00:00
ayazhafiz
ed64ff912a Implement List.dropIf
This was referenced in the `List` documentation and in the
[tutorial](./TUTORIAL.md), but wasn't actually implemented prior to this
commit!

Part of #2227
2021-12-22 12:34:48 -06:00
Brian Carroll
e847c924dd Lowlevels: replace RefCountGetPtr with the more general GetPtrAsInt. 2021-12-19 08:29:17 +00:00
Jan Van Bruggen
d03a51c75b Rename base package to pf everywhere, to match tutorial 2021-12-12 05:57:39 -07:00
Richard Feldman
1ce648ac27
Merge pull request #2116 from rtfeldman/str_to_num
Str.toNum
2021-12-09 09:48:38 -05:00
rvcas
b7d48b2fe1 feat: add the rest of the num types for Str conversion 2021-12-06 23:24:02 -05:00
rvcas
e587e20de2 feat: switch to using a builtin per num type to convert from a string 2021-12-06 22:24:00 -05:00
Anton-4
e63701c5d1 trying to make Str.toNum work for Ints 2021-12-01 20:37:21 +01:00
Anton-4
2e21fd0cb9 Merge branch 'str-to-num' of github.com:rtfeldman/roc into str_to_num 2021-12-01 19:43:01 +01:00
Folkert
69fc1ad7e7 sketch of StrToNum 2021-12-01 15:33:16 +01:00
Anton-4
eaf4e57759 started on Str.toNum 2021-12-01 15:15:30 +01:00
Brian Carroll
a3827d6636
Merge pull request #2071 from rtfeldman/refcount-mono-ir
Start generating refcounting code as mono IR
2021-12-01 12:59:16 +00:00
rvcas
f995a07029 feat: Num.toStr
* add type for Num.toStr
  * create new lowlevel
  * delete types and Symbol for fromInt and fromFloat
  * leave LowLevel::{StrFromFloat,StrFromInt}
  * match on LowLevel::NumToStr and figure out the layout to decide
    which build function to delegate to
2021-11-30 14:52:06 -05:00
Brian Carroll
6e5acadfea Create new lowlevels for refcounting 2021-11-30 09:57:00 +00:00
Brendan Hansknecht
57d9ce3fdd
Merge pull request #2043 from rtfeldman/dev-backend-num-is-zero
add x86_64 Int is zero support for gen_dev
2021-11-27 09:53:59 -08:00
Folkert
308b91153e add faster insertion path for tag unions 2021-11-24 20:38:52 +01:00
satotake
10afadd810 Merge branch 'trunk' into dev-backend-num-is-zero 2021-11-24 10:59:42 +00:00
satotake
4376db6c17 use load_literal 2021-11-23 10:09:53 +00:00
Folkert
2c1005fdf0 remove lowercases from Content 2021-11-22 21:15:58 +01:00
Richard Feldman
49fd864a2f
Merge pull request #1996 from rtfeldman/add_list_all
adding List.all
2021-11-19 17:55:04 -05:00
Folkert de Vries
71233fcfc1
Merge pull request #2012 from rtfeldman/i/1714
Take syntactic sugar into account when reporting errors
2021-11-19 10:26:24 +01:00
Folkert de Vries
a58c999d3e
Merge pull request #2008 from rtfeldman/improve-typo-suggestions
Minor improvements to "did you mean?" suggestions provided for missing identifiers
2021-11-19 10:24:52 +01:00
ayazhafiz
fe99d20be5 Apply review suggestions 2021-11-18 21:49:37 -05:00
ayazhafiz
5bfc52cd3b Remove Sugar enum and inline single variant into CalledVia 2021-11-18 21:23:41 -05:00
ayazhafiz
8a60162a1e Rename roc_module::operator -> roc_module::called_via
A bit of a nit, but this file is now more general than just keeping
track of operator methods.
2021-11-18 20:20:33 -05:00
ayazhafiz
30955a1eb8 Take syntactic sugar into account when reporting errors
Previously, a program like

```roc
word = "word"

if True then 1 else "\(word) is a word"
```

would report an error like

```
── TYPE MISMATCH ───────────────────────────────────────────────────────────────

This `if` has an `else` branch with a different type from its `then` branch:

3│  if True then 1 else "\(word) is a word"
                        ^^^^^^^^^^^^^^^^^^

This concat all produces:

    Str

but the `then` branch has the type:

    Num a

I need all branches in an `if` to have the same type!
```

but this is a little bit confusing, since the user shouldn't have to
know (or care) that string interpolations are equivalent to
concatenations under the current implementation.

Indeed we should make this fully transparent. We now word the error
message by taking into account the way calls are made. To support the
case shown above, we introduce the `CalledVia::Sugar` variant to
represent the fact that some calls may be the result of desugaring the
surface syntax.

This commit also demonstrates the usage of `CalledVia` to produce better
error messages where we use binary comparison operators like `<`. There
are more improvements we can make here for all `CalledVia` variants, but
this is a good starting point to demonstrate the usage of the new
procedure.

Closes #1714
2021-11-18 20:20:33 -05:00
Michael Downey
d11bb93539
Merge branch 'trunk' into add_list_all 2021-11-18 16:09:24 -05:00
Folkert de Vries
a4fc813ca3
Merge pull request #2002 from rtfeldman/builtins-list-intersperse
Add builtin `List.intersperse`
2021-11-18 22:00:10 +01:00