Commit graph

305 commits

Author SHA1 Message Date
Folkert
490bbf3812 ignore 'normal' functions when running i386 tests 2022-01-26 19:59:50 +01:00
Folkert
5580eafb68 Merge remote-tracking branch 'origin/trunk' into tea-example 2022-01-25 09:20:59 +01:00
Folkert
73bc50c952 make the surgical linker aware of custom exported closure names 2022-01-25 00:13:22 +01:00
Folkert
cbdf3f0378 tweaks 2022-01-23 21:41:54 +01:00
ayazhafiz
0eede1cd86 Generate unique symbols for shadowing identifiers
This code has a shadowing error:

```
b = False
f = \b -> b
f b
```

but prior to this commit, the compiler would hit an internal error
during monomorphization and not even get to report the error. The reason
was that when we entered the closure `\b -> b`, we would try to
introduce the identifier `b` to the scope, see that it shadows an
existing identifier, and not insert the identifier. But this meant that
when checking the body of `\b -> b`, we would think that we captured the
value `b` in the outer scope, but that's incorrect!

The present patch fixes the issue by generating new symbols for
shadowing identifiers, so deeper scopes pick up the correct reference.
This also means in the future we may be able to compile and execute code
with shadows, even though it will still be an error.

Closes #2343
2022-01-23 12:35:31 -05:00
Richard Feldman
6d8277ad8d
Merge pull request #2367 from rtfeldman/remove_Num.minmaxInt
Remove `Num.(min/max)Int`
2022-01-20 00:19:44 -05: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
1e9d2d1239 Remove accidental trailing spaces 2022-01-18 22:25:46 -07:00
ayazhafiz
6ea7d63380 Make sure line offsets are generated properly for external programs
Closes #2329
2022-01-13 20:59:03 -05:00
ayazhafiz
880bae55b0 Print u8-sized integers in repl properly
Closes #2335
2022-01-10 19:41:07 -05:00
ayazhafiz
605cad1114 Reify commented-out tests 2022-01-08 15:24:17 -05:00
ayazhafiz
fd474528eb Unroll newtypes that are records 2022-01-08 15:11:27 -05:00
ayazhafiz
85efcbccdd Support functions in structures
Closes #2313
2022-01-06 23:09:47 -06:00
Joshua Warner
5f7bec3ee8 Use assert_multiline_str_eq in repl_eval tests 2022-01-01 18:20:05 -08:00
Folkert
06be340bee add test for this issue 2021-12-31 21:48:14 +01:00
ayazhafiz
983a9f7e17 Position correct basic block before calling error catcher
While building the main function for tests, we may need to generate
additional blocks while marshalling arugments to the error catcher into
the expected calling convention. This pushes the last block in the main
function down, so that the "entry" block may not be last BB in the
function. Instead, look up the last insertion block before generating
the catcher, and then add a call to the catcher at the end of this last
block.

Closes #2300
2021-12-30 20:55:43 -06:00
ayazhafiz
d966d8921f Support nullable wrapped tag union layouts in REPL 2021-12-29 17:55:21 -06:00
ayazhafiz
cdcc31f199 Support nullable unwrapped tag layouts in REPL 2021-12-29 17:55:21 -06:00
ayazhafiz
9c147c8b70 Support non-nullable unwrapped unions in repl 2021-12-29 17:55:21 -06:00
ayazhafiz
b7c9713232 Support nested non-recursive unions in REPL eval 2021-12-29 17:55:21 -06:00
ayazhafiz
2c25bac695 Support rendering general "regular" recursive tag unions in REPL 2021-12-29 17:55:21 -06:00
ayazhafiz
a9ae8aea22 Retrieve recursive tag union IDs when tag is stored next to data 2021-12-29 17:55:21 -06:00
ayazhafiz
71bd77e3b2 Handle flat variants of recursive tag unions in repl 2021-12-29 17:55:21 -06:00
ayazhafiz
3fcc59fb8e Improve repl output of nested newtypes 2021-12-29 17:55:21 -06:00
ayazhafiz
9938f7c832 Support multiline inputs from non-tty stdins 2021-12-29 17:55:19 -06:00
ayazhafiz
5e5eb6dca8 (llvm) Generate code for tag unions less than 64 bits in size correctly
Previously, we assumed that a union layout always lived on >= 1 64-bit
boundary when generating an LLVM type for it. For small tags unions,
like `[ Ok i8, Err ]` this need not be the case; indeed, a tag union
like that is actually only 2 bits - 1 bit for the "i8" data, and one bit
of the tag kind.

This led to a discrepancy between what the layout IR and generated LLVM
code would assume about the size of tag unions. In the case above, the
layout IR would assume the tag data is 2 bits wide, and the tag id is 1
bit into the data. But the LLVM code would generate a type that was 65
bits wide, the first 64 bits being for the "i8" data and the last 1 bit
being for the tag kind.

Usually, just running the LLVM-emitted code would not present a problem.
But it does present a problem when we use the layout IR to inspect the
result of LLVM-run code, in particular when we try to look up the tag
ID, as the repl does. This patch fixes that issue.

Note that this bug did not present itself in `test_gen` previously
because the data that most tests check against is stored in the front of
the representation.

Closes #2149
2021-12-26 11:45:02 -06:00
Joshua Warner
8b58d5cbc7 Switch to always encoding package names / paths as strings
This will simplify parsing and make it possible to have a uniform lexer for the language. Previously unquoted package names were allowed to include '-'s, which aren't valid identifiers.

In the future, we'll distinguish local paths from packages in the package-manager by looking for a ".roc" suffix, which should only be present in local paths.
2021-12-23 20:11:14 -08:00
Jan Van Bruggen
d03a51c75b Rename base package to pf everywhere, to match tutorial 2021-12-12 05:57:39 -07:00
Anton-4
0f064c121e
Merge branch 'trunk' into valgrind_instr_fix 2021-11-16 12:24:26 +01:00
Anton-4
6e23919811 put mcpu in comments 2021-11-15 13:43:19 +01:00
Folkert
d18c09a21d misc other clippy things 2021-11-13 16:04:50 +01:00
Anton-4
030a504bd2 valgrind flag 2021-11-13 14:39:15 +01:00
Folkert
acb26002c8 fix repl 2021-11-10 23:36:16 +01:00
Shritesh Bhattarai
b6872a06d1 Add cli test for hello-swift 2021-11-02 21:28:01 -04:00
Folkert
391025145f Merge remote-tracking branch 'origin/trunk' into false-cleanup 2021-10-30 00:56:13 +02:00
Richard Feldman
1b691ec37e
Add comment for why false interpreter CLI test is only run in prod 2021-10-27 09:53:03 -04:00
Folkert
d561f2661d speedups 2021-10-27 00:01:21 +02:00
Brendan Hansknecht
056b10b36b Merge branch 'trunk' into false-cleanup 2021-10-24 11:49:30 -07:00
Brendan Hansknecht
9e9ebc9e41 Enable valgrind in testing 2021-10-24 11:42:05 -07:00
Kevin Sjöberg
3bea23bed5 Ensure we pass stdout (the String contents) instead of the Out struct 2021-10-24 16:13:48 +02:00
Folkert
84950366b0 Merge remote-tracking branch 'origin/trunk' into false 2021-10-21 20:20:56 +02:00
Brendan Hansknecht
b4be6da3a4 Add cli test for false interpreter 2021-10-19 11:27:05 -07:00
Folkert
4152519bfb formatting & catch zig overflow error 2021-10-17 18:03:40 +02:00
Chelsea Troy
03295d4369 So far, add type for divCeil to the language 2021-10-17 09:29:11 -05:00
Folkert
ed52615d4c fix Foo Bar 2021-10-13 14:34:59 +02:00
Chelsea Troy
475326c005 cargo fmt 2021-10-11 20:48:19 -05:00
Chelsea Troy
051b511d87 Remove parentheses from unapplied tags 2021-10-11 20:42:07 -05:00
Richard Feldman
696a8273ee
Merge pull request #1742 from rtfeldman/test-linker
Test linker
2021-10-03 23:26:15 -04:00
Richard Feldman
47c52b0220
Merge pull request #1737 from rtfeldman/fix-repl-sum-crash
repl cannot handle some functions
2021-10-03 15:52:26 -05:00
Anton-4
09917b1f01 ignore missing RBTreeDel test 2021-10-03 18:34:04 +02:00