Commit graph

7030 commits

Author SHA1 Message Date
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
ayazhafiz
3c2822224a Update expected failure tests to use expect_runtime_error_panic 2021-12-22 09:23:50 -06:00
ayazhafiz
823e32961f Add macro to expect runtime error panic through llvm backend, and a test 2021-12-22 09:17:54 -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
Joshua Warner
825b93696c Improve error message & comment 2021-12-21 18:23:04 -08:00
Joshua Warner
6786acb939 Remove redundant space in aliases 2021-12-21 18:16:58 -08:00
ayazhafiz
903fa7d363 Fix clippy warning: implement From over Into 2021-12-21 19:55:50 -06:00
Joshua Warner
4fed812389 add test_fmt_examples 2021-12-21 17:25:36 -08: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
471e2c3143 Completely delete Wasm BlockType 2021-12-21 23:14:55 +00:00
Brian Carroll
1c20075d7b Change usage of Wasm if instruction now that we don't support block results anymore 2021-12-21 23:14:55 +00:00
Brian Carroll
a99db445e4 Disable broken tests 2021-12-21 18:36:30 +00:00
Folkert de Vries
2f1c648602
Merge pull request #2253 from rtfeldman/wasm-no-block-results
Wasm: fix nested conditionals
2021-12-21 16:35:22 +01:00
Folkert de Vries
af03ba13b1
Merge pull request #2246 from rtfeldman/wasm-refactor-symbol-layouts
Wasm: Move symbol_layouts to storage.rs
2021-12-21 16:24:38 +01:00
Folkert de Vries
18187bc43f
Merge pull request #2245 from rtfeldman/wasm-tag-eq
Wasm tag equality
2021-12-21 16:24:14 +01:00
Brian Carroll
2a141b3586 Automatically clean up any unused values at the end of a block 2021-12-21 13:16:15 +00:00
Brian Carroll
17dc6668ec Make all Wasm blocks NoResult and always put return value in a local var. 2021-12-21 13:16:15 +00:00
Brian Carroll
51119c8142 Emit less code for ensure_value_has_local 2021-12-21 13:16:15 +00:00
rvcas
e269fc4345 test(wasm): more wasm_str tests 2021-12-20 17:48:34 -05:00
rvcas
c6eaf3abd3 feat(wasm): enable more Str LowLevels 2021-12-20 17:47:39 -05:00
Richard Feldman
3ffe5768e1
Merge pull request #2239 from rtfeldman/joshuawarner32/pipeline-format-fail
Fix formatting of pipelined call exprs
2021-12-20 15:46:23 -05:00
Richard Feldman
5aa67d4244
Merge pull request #2231 from rtfeldman/joshuawarner32/record_func_type_decl
Allow function types in records
2021-12-20 11:45:27 -05:00
Brian Carroll
6480a720ae Move symbol_layouts to storage.rs 2021-12-20 16:06:39 +00:00
Richard Feldman
4a900b3097
Merge pull request #2238 from rtfeldman/joshuawarner32/refactor-BadOperator
Refactor BadOperator to take a &str rather than &[u8]
2021-12-20 10:16:27 -05:00
Richard Feldman
f32b208ba9
Merge pull request #2240 from rtfeldman/joshuawarner32/trailing-spaces
Remove trailing whitespace from the output of the formatter
2021-12-20 10:14:10 -05:00
Brian Carroll
3b2aa0bf6a Fix bugs with symbol layouts in Wasm 2021-12-20 09:53:24 +00:00
Brian Carroll
9b833720d4 Further refactor and debug == in Wasm 2021-12-20 08:39:16 +00:00
Brian Carroll
f59e0e249b Use native instructions for NotEq in Wasm 2021-12-19 21:20:06 +00:00
Brian Carroll
e0ffaca3df Refactor Wasm equality operator 2021-12-19 21:20:06 +00:00
Brian Carroll
c510226c15 Reorganise Wasm lowlevels to get pointer equality working correctly 2021-12-19 21:20:06 +00:00
Brian Carroll
ece28f1975 Fix loading code for Zig calling convention 2021-12-19 21:20:06 +00:00
Brian Carroll
635c9757dd Implement Eq for tags in CodeGenHelp 2021-12-19 21:20:01 +00:00
Brian Carroll
3041b6fa1c
Merge pull request #2242 from rtfeldman/lowlevel-ptr-cast
Lowlevel ptr cast
2021-12-19 16:45:12 +00:00
Brian Carroll
0bdf76f81a
Merge pull request #2234 from rtfeldman/str-split-empty-delimiter
Add empty-delimiter handling for `Str.split`
2021-12-19 12:43: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
Joshua Warner
48c207bb06 Remove trailing whitespace from the output of the formatter 2021-12-18 17:14:14 -08:00
Joshua Warner
61cdbd1531 Fix formatting of pipelined call exprs 2021-12-18 16:36:51 -08:00
Lucas
6685321df0
Merge pull request #2235 from rtfeldman/fix-maxDec-minDec-docs
Fix typos in docs for `Num.maxDec` & `Num.minDec`
2021-12-18 19:33:48 -05:00
Joshua Warner
96e8916594 Refactor BadOperator to take a &str rather than &[u8] 2021-12-18 14:42:48 -08:00
Joshua Warner
efa54287f1 Return the original error if there's an unexpected trailing comma 2021-12-18 13:26:59 -08:00
Folkert de Vries
39979702f4
Merge pull request #2237 from rtfeldman/wasm-record-equality
Wasm record equality
2021-12-18 22:25:11 +01:00
Brian Carroll
a1d883600c Equality operator for records 2021-12-18 17:25:00 +00:00
Jan Van Bruggen
8cc5abd219 Fix typos in docs for Num.maxDec & Num.minDec 2021-12-18 01:21:20 -07:00