Commit graph

1741 commits

Author SHA1 Message Date
ayazhafiz
a626214852 Fix use of undeclared symbol
090a8923c5 changed `Located -> Loc`, but
5d7aff373c introduced another instance of
`Located` and didn't have the commit history of 090a8923c5
2021-12-23 17:58:12 -06:00
Folkert de Vries
5f7476d54f
Merge pull request #2266 from rtfeldman/joshuawarner32/loc
Parser refactor: always group (Row, Col) into Position
2021-12-24 00:02:13 +01:00
Folkert de Vries
db44d03e66
Merge pull request #2259 from rtfeldman/i/2227-record-layout-hang
Turn invalid record field types into runtime errors
2021-12-23 20:17:34 +01:00
Joshua Warner
22e2545fd6 format 2021-12-22 20:46:42 -08:00
Joshua Warner
f19220473a Rename Located -> Loc 2021-12-22 19:18:22 -08:00
ayazhafiz
ac54a5e024 Remove nonsene panic 2021-12-22 19:38:10 -06: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
d33c1b54fd Ensure unique names for helper procs 2021-12-22 09:28:20 +00:00
Brian Carroll
4a970f089a Eq for empty list 2021-12-22 09:22:31 +00:00
Brian Carroll
e9ae8452b0 Equality tests passing for List I64 2021-12-22 08:42:39 +00:00
ayazhafiz
903fa7d363 Fix clippy warning: implement From over Into 2021-12-21 19:55:50 -06:00
ayazhafiz
e451c3a1f9 Small refactoring: coalesce record field collection loop 2021-12-21 19:23:07 -06:00
ayazhafiz
576f1293fd Turn invalid record field types into runtime errors
By emitting a runtime error rather than panicking when we can't layout
a record, we help programs like

```
main =
    get = \{a} -> a
    get {b: "hello world"}
```

execute as

```
Mismatch in compiler/unify/src/unify.rs Line 1071 Column 13
Trying to unify two flat types that are incompatible: EmptyRecord ~ { 'a' : Demanded(122), }<130>

🔨 Rebuilding host...
── TYPE MISMATCH ───────────────────────────────────────────────────────────────

The 1st argument to get is not what I expect:

8│      get {b: "hello world"}
            ^^^^^^^^^^^^^^^^^^

This argument is a record of type:

    { b : Str }

But get needs the 1st argument to be:

    { a : a }b

Tip: Seems like a record field typo. Maybe a should be b?

Tip: Can more type annotations be added? Type annotations always help
me give more specific messages, and I think they could help a lot in
this case

────────────────────────────────────────────────────────────────────────────────

'+fast-variable-shuffle' is not a recognized feature for this target (ignoring feature)
'+fast-variable-shuffle' is not a recognized feature for this target (ignoring feature)
Done!
Application crashed with message

    Can't create record with improper layout

Shutting down
```

rather than the hanging

```
Mismatch in compiler/unify/src/unify.rs Line 1071 Column 13
Trying to unify two flat types that are incompatible: EmptyRecord ~ { 'a' : Demanded(122), }<130>

thread '<unnamed>' panicked at 'invalid layout from var: UnresolvedTypeVar(104)', compiler/mono/s
rc/layout.rs:1510:52
```

that was previously produced.

Part of #2227
2021-12-21 19:11:59 -06:00
Brian Carroll
d58a2814f6 Generate IR for list equality 2021-12-21 23:14:55 +00:00
Brian Carroll
a2ada314ce local constants for ARG_1 and ARG_2 2021-12-21 23:14:55 +00:00
Brian Carroll
7477b8239d Get rid of some function arguments that are always the same 2021-12-21 23:14:55 +00:00
Brian Carroll
9b833720d4 Further refactor and debug == in Wasm 2021-12-20 08:39:16 +00:00
Brian Carroll
635c9757dd Implement Eq for tags in CodeGenHelp 2021-12-19 21:20:01 +00:00
Brian Carroll
570044f88a Check pointer equality for Eq on Structs 2021-12-19 09:06:06 +00:00
Brian Carroll
e847c924dd Lowlevels: replace RefCountGetPtr with the more general GetPtrAsInt. 2021-12-19 08:29:17 +00:00
Brian Carroll
a1d883600c Equality operator for records 2021-12-18 17:25:00 +00:00
Brian Carroll
55f5956175 Add comments to group code together 2021-12-18 00:23:31 +00:00
Brian Carroll
71bb756d20 Move related code closer together 2021-12-18 00:12:19 +00:00
Brian Carroll
2d887b297f Fill out match expressions in generate_procs 2021-12-18 00:11:18 +00:00
Brian Carroll
0f2d14490f Clippy fixes 2021-12-16 16:58:37 +00:00
Brian Carroll
307ab9ee83 Use a single enum for all helpers 2021-12-16 16:56:56 +00:00
Brian Carroll
3eb9e9f7ac Traverse nested layouts for code gen helpers 2021-12-16 16:56:56 +00:00
Brian Carroll
ae9e5f115f Generate specialized call for Eq 2021-12-16 16:56:56 +00:00
Brian Carroll
e1a04c2661 Only check layout is implemented for RC, not other ops 2021-12-16 16:56:56 +00:00
Brian Carroll
3adaacc66e Add some comments 2021-12-16 16:56:53 +00:00
Brian Carroll
cd91be678f Setup for specializing equality checks 2021-12-16 16:52:47 +00:00
Brian Carroll
ee97eb668d Add Eq operation to code gen helpers 2021-12-16 16:52:47 +00:00
Brian Carroll
efef2be958 Rename mono IR code gen helpers 2021-12-16 16:52:47 +00:00
Brian Carroll
71de2289ae Rename helper proc generator struct 2021-12-16 16:52:47 +00:00
Brian Carroll
0547647341 Rename code gen helper file in mono 2021-12-16 16:52:47 +00:00
Brian Carroll
c290bbe7a7 Move layout calculations to layout module 2021-12-12 12:22:10 +00:00
Brian Carroll
c53b3c3686 Skip refcounting on unimplemented layouts 2021-12-11 20:33:11 +00:00
Brian Carroll
211a5d9bf3 Fix apparent bug in Layout::is_refcounted
It contradicts build_tag in compiler/gen_llvm/src/llvm/build.rs,
where we create a NonNullableUnwrapped by calling
reserve_with_refcount_union_as_block_of_memory
2021-12-11 20:33:11 +00:00
Brian Carroll
031dce61c9 Add a stack_size_and_alignment method to Layout 2021-12-11 20:33:11 +00:00
Brian Carroll
7b6ba79eee Merge branch 'trunk' of github.com:rtfeldman/roc into wasm-tags 2021-12-10 11:48:56 +00:00
Richard Feldman
1ce648ac27
Merge pull request #2116 from rtfeldman/str_to_num
Str.toNum
2021-12-09 09:48:38 -05:00
Brian Carroll
2f4225eec6 Add more doc comments to UnionLayout enum 2021-12-08 20:30:26 +00:00
Brendan Hansknecht
b8a287d1ba Merge remote-tracking branch 'origin/trunk' into refcount-gen-dev 2021-12-08 11:22:36 -08:00
Folkert
28b4388488 remove unneeded field 2021-12-05 15:25:46 +01:00
Folkert
d7045b037f use param_map instead of localcontext 2021-12-05 15:21:25 +01:00
Folkert
eaefb56994 make some helper functions non-mut 2021-12-03 21:50:39 +01:00
Anton-4
c63c69f1ef prep merge with Folkert's branch 2021-12-01 19:42:22 +01:00
Anton-4
eaf4e57759 started on Str.toNum 2021-12-01 15:15:30 +01:00
Richard Feldman
e6bec46898
Merge pull request #2109 from rtfeldman/refactor-passed-function
refactor passed (to higher order lowlevel) funcion
2021-12-01 08:17:39 -05: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