Commit graph

346 commits

Author SHA1 Message Date
Ayaz Hafiz
5a1898b285
Pretty-print opaque refs 2023-02-20 18:42:05 -06:00
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Ayaz Hafiz
009607c55a
Handle FunctionOrTagUnion types in exhaustiveness checking
We should treat FunctionOrTagUnion types as tag unions for the purposes
of exhautiveness checking.

Closes #4994
2023-02-01 22:03:10 -06:00
Folkert
3417a0e059
fix silent merge request wrt record accessors 2023-01-25 00:02:19 +01:00
Folkert de Vries
8e5efe67b4
Merge pull request #4912 from roc-lang/remove-polymorphic-expression-compilation
Rip out polymorphic expression compilation
2023-01-24 21:35:08 +01:00
Joshua Warner
de828416bf
Initial implementation of tuples in type checking
This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.
2023-01-22 12:40:44 -08:00
Ayaz Hafiz
6b491c617e
Store def name on accessor functions 2023-01-21 12:37:09 -06:00
Ayaz Hafiz
c9460ecf3f
Rename IsImplicitOpennessVar 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
5fceb9ceb7
Push implicit openness vars through 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
96b2b7a0c5
Fix comment 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
1c93727822
Add a notion of "openness" tag extensions suitable only for size-polymorphism 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
3d0a0a4a99
Update more dict/set references 2023-01-14 15:33:54 +01:00
Richard Feldman
ab7de647e4
Merge pull request #4863 from joshuawarner32/better-scalar-literals
Improve parsing of scalar literals
2023-01-09 11:42:44 -05:00
Ayaz
7c61d0d278
Merge pull request #4843 from roc-lang/pattern-as-can
Pattern as can
2023-01-08 19:36:40 -06:00
Folkert
c2ddeb0de0
fix and test as pattern type inference 2023-01-08 16:40:03 +01:00
Joshua Warner
94070e8ba6
Improve parsing of scalar literals
* Unify parsing of string literals and scalar literals, to (e.g.) ensure escapes are handled uniformly. Notably, this makes unicode escapes valid in scalar literals.
* Add a variety of custom error messages about specific failure cases of parsing string/scalar literals. For example, if we're expecting a string (e.g. a package name in the header) and the user tried using single quotes, give a clear message about that.
* Fix formatting of unicode escapes (they previously used {}, now correctly use () to match roc strings)
2023-01-07 15:12:52 -08:00
Ayaz Hafiz
bcfb258db8
Add a bit to mark syntactically-generalizable types 2023-01-04 17:02:20 -06:00
Ayaz Hafiz
3b0e2429e6
Support printing weak type variables in tests
Unbound type variables that are not at the generalization rank will now
be printed as `w_a` in solve tests.
2023-01-04 16:24:19 -06:00
Ayaz
9171799c67
Merge pull request #4841 from roc-lang/parse-pattern-as
Parse pattern as
2022-12-31 13:19:57 -06:00
Folkert
2e27746413
can for list .. as 2022-12-31 16:00:40 +01:00
Folkert
905341d849
can for normal (no-list) as 2022-12-31 15:46:11 +01:00
Richard Feldman
879b957676
Delete unused branch (it never got hit on CI) 2022-12-30 22:40:45 -05:00
Folkert
aff70bb6bd
refactor PatternAs 2022-12-30 18:22:10 +01:00
Folkert
e9196f3c0b
parse and format pattern as 2022-12-30 17:50:17 +01:00
Richard Feldman
8e2eb2b28d
Check if a branch is unreachable 2022-12-29 20:48:45 -05:00
Richard Feldman
e5a0509380
Fix merge issue 2022-12-24 22:32:14 -05:00
Richard Feldman
15d4c2ad68
Don't render undexposed types in docs 2022-12-24 22:32:13 -05:00
Folkert
4ef541395a
remove dbg lowlevel 2022-12-22 02:45:09 +01:00
Richard Feldman
3e448fd2b4
Merge remote-tracking branch 'origin/main' into packages 2022-12-17 03:32:52 -05:00
Richard Feldman
3e5b62db1a
Move exposes into HeaderType 2022-12-13 06:59:25 -05:00
Ayaz Hafiz
50992d35aa
Support printing lambda names in print decls 2022-12-12 14:13:32 -06:00
Ayaz Hafiz
04e1e0cd6e
Support better printing of symbols 2022-12-12 10:38:53 -06:00
Ayaz Hafiz
3a2cd2f7c8
Pretty-print canonicalized declarations 2022-12-12 10:28:23 -06:00
Ayaz Hafiz
7135df6d2f
Move can AST pretty-printing into roc_can::debug 2022-12-12 10:09:32 -06:00
Richard Feldman
e47898dfff
Rename some more header_for to header_type 2022-12-11 03:02:20 -05:00
Richard Feldman
e3687935a3
Merge remote-tracking branch 'origin/main' into refactor-platform-info 2022-12-09 22:21:25 -05:00
Folkert
13d0b75bc1
Merge remote-tracking branch 'origin/main' into expect-print-values 2022-12-08 23:42:03 +01:00
Richard Feldman
97332e4af1
Move ModuleNameEnum into HeaderType 2022-12-08 15:31:43 -05:00
Richard Feldman
87c8702c89
Rename HeaderFor to HeaderType 2022-12-08 15:31:42 -05:00
Ayaz Hafiz
42fe19541e
Define inline expects defs in their definition order
When we transform a top-level expect into an inline expect, we collect
all intermediate defs before the expect condition, then layer the defs
back on. Because the layering procedure builds an expression bottom-up,
we must layer on defs in reverse definition order.

Closes #4705
2022-12-07 10:54:16 -06:00
Ayaz Hafiz
8ca9e6b443
Be more explicit about imported flex and rigid vars 2022-12-05 13:04:15 -06:00
Folkert
7c6cc97cd4
Merge remote-tracking branch 'origin/main' into expect-print-values 2022-12-02 20:28:04 +01:00
Ayaz Hafiz
0f6f34983f
Remove stale comment 2022-12-02 11:50:12 -06:00
Ayaz Hafiz
0a807dc43e
Provide warning for defs that are used only in (mutual) recursion
This patch provides errors for defs that are used only in
possibly-mutual recursion, and are not reachable outside of their
recursive closures. For example:

```
test_report!(
    mutual_recursion_not_reached_nested,
    indoc!(
        r#"
        app "test" provides [main] to "./platform"

        main =
            f = \{} -> if Bool.true then "" else g {}
            g = \{} -> if Bool.true then "" else f {}
            ""
        "#
    ),
@r###"
── DEFINITIONs ONLY USED IN RECURSION ──────────────────── /code/proj/Main.roc ─

These 2 definitions are only used in mutual recursion with themselves:

4│>      f = \{} -> if Bool.true then "" else g {}
5│>      g = \{} -> if Bool.true then "" else f {}

If you don't intend to use or export any of them, they should all be
removed!
"###
);
```
2022-12-02 11:50:12 -06:00
Ayaz Hafiz
34328ddf0c
Unused import 2022-12-02 08:50:04 -06:00
Ayaz Hafiz
078f0147ee
Do not bind accessors in toplevel thunks to their thunks' names
In #3352 an optimization to transform `ra = .field` into

```
ra = \#rcd -[ra]-> #rcd.field
```

rather than

```
__ra1 = \#rcd -[__ra1] -> #rcd.field

ra = LambdaSet { __ra1 }
```

was introduced. However, this optimization is not correct when `ra =
.field` is defined as a toplevel thunk, for in such situations we
indeed want the thunk `ra` to return the lambda set it resolves to,
rather than repointing at itself.

Besides reverting this change, another option would be to convert
accessors into closures before translation of Can to IR. However, this
complicates the translation algorithm more than it already is, and I'd
like to avoid additional special-cases.

Closes #4606
2022-12-02 08:50:03 -06:00
Folkert
1e41aac0f2
lookup symbols when coming from Defs 2022-12-02 15:43:48 +01:00
Folkert
db09d49cd7
implement two todo!'s 2022-12-02 15:43:48 +01:00
Richard Feldman
58fad36f9d
Merge pull request #4460 from roc-lang/crash
Crash
2022-11-25 17:18:21 -05:00
Folkert
bc3414e913
spelling 2022-11-25 18:30:04 +01:00