Commit graph

416 commits

Author SHA1 Message Date
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
Folkert
947051749d fix typo 2021-11-18 13:17:29 +01:00
Folkert
f99542f066 add special symbol for removed specializations 2021-11-18 13:15:00 +01:00
Michael Downey
9d587d37b4
Merge branch 'trunk' into add_list_all 2021-11-18 06:41:08 -05:00
satotake
ce8a88416d Merge branch 'trunk' into builtins-list-intersperse 2021-11-18 11:16:27 +00:00
ayazhafiz
c156f61b0f Suggest tags of primitive types when an ident is misspelled
With this change, mispellings of things like `true` and `false` will
include a hint to the user that they may want to use `True` and `False`,
respectively, instead.

There are a few ways to implement this, but exposing these common tags
(which compose builtin type aliases) seems the easiest, least expensive,
and doesn't break anything for now.
2021-11-17 22:40:51 -05:00
Richard Feldman
2bb007e08b
Merge pull request #1987 from rtfeldman/builtins-list-split
Add builtin `List.split`
2021-11-17 13:41:58 -05:00
satotake
16fb04b4fa Add builtin List.intersperse 2021-11-17 15:18:45 +00:00
Michael Downey
d946b84e63 adding initial List.all 2021-11-16 16:34:36 -05:00
satotake
46e6e22776 use closure 2021-11-16 12:58:45 +00:00
satotake
541465bc2e Use let 2021-11-16 11:13:37 +00:00
Folkert
163656b2bd fix merge conflict 2021-11-15 20:13:50 +01:00
Folkert de Vries
1a3f2aed4f
Merge branch 'trunk' into refactor-builtin-list-drop 2021-11-15 19:51:17 +01:00
satotake
73dda714de Add builtin List.split 2021-11-15 13:50:11 +00:00
Brian Carroll
46636ef331 Ensure lowlevel inlining does not skip bounds checks 2021-11-15 12:56:34 +00:00
satotake
c253273490 Merge branch 'trunk' into refactor-builtin-list-drop 2021-11-15 11:37:32 +00:00
satotake
8e29daa160 remove low-level List.drop codes 2021-11-15 11:28:38 +00:00
Brian Carroll
e200e6c346 Clippy + fmt 2021-11-15 09:52:16 +00:00
Brian Carroll
79bd9ccf71 Symbol-to-lowlevel mapping for both dev backends 2021-11-15 00:27:04 +00:00
Brian Carroll
00793eb0d8 Fix inexhaustive pattern matches in low_level 2021-11-15 00:06:31 +00:00
Theo Felippe
8d7c252fce implemented Str.trimRight 2021-11-13 18:02:58 +00:00
Folkert de Vries
c9b15766be
Merge branch 'trunk' into builtins-refactor-list-take 2021-11-13 13:29:57 +01:00
Theo Felippe
10eab4b785 implemented Result.isErr 2021-11-13 08:29:40 +00:00
satotake
9ec2bc7946 Remove takeFirst and takeLast from backend 2021-11-13 06:03:18 +00:00
satotake
98d2c57edf move List.sublist to backend 2021-11-13 04:57:28 +00:00
satotake
8f8b2463ea reset 2021-11-13 03:38:58 +00:00
satotake
4359dcff73 Merge branch 'trunk' into builtins-refactor-list-take 2021-11-13 03:38:29 +00:00
Brian Carroll
daf6771bf5 Shorten the name of the Symbol for temporary Wasm values 2021-11-12 17:51:50 +00:00
satotake
d63849c5a3 Add List.takeFisrt2, List.takeLast2 for demo 2021-11-12 13:47:28 +00:00
Theo Felippe
84af26d813 added placeholder implementation 2021-11-11 19:13:42 +00:00
Folkert de Vries
b3a663a741
Merge branch 'trunk' into builtins-list-sublist 2021-11-10 16:28:58 +01:00
satotake
9f5d3f521b Implement List.sublist 2021-11-10 13:16:57 +00:00
Michael Downey
07cd3850d7
Merge branch 'trunk' into str_trim_left 2021-11-09 19:43:26 -05:00
Michael Downey
1bc278d962 initial commit of Str.trimLeft 2021-11-09 14:25:24 -05:00