Commit graph

178 commits

Author SHA1 Message Date
Ayaz Hafiz
beb7e79830
Print extension vars that are ability-bound 2023-01-14 15:33:54 +01:00
Folkert de Vries
e3a213c0dc
Merge pull request #4882 from roc-lang/weakening-3
Begin weakening let-bindings to non-function, non-number expressions
2023-01-14 15:32:27 +01:00
Ayaz Hafiz
b2cdddbdfb
Weaken lists 2023-01-12 10:02:20 -06:00
Richard Feldman
dc8eb81bb2
Omit more unnecessary fields from record diffs 2023-01-11 23:18:53 -05:00
Ayaz Hafiz
d214598a16
Rename rank none to rank generalized 2023-01-11 14:55:18 -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 Hafiz
5b9e3aa856
Handle error types in record/tag extensions when printing errors 2022-12-27 13:20:28 -06:00
Ayaz Hafiz
cd2b936a59
Ensure that disjoint nested lambda sets force parents to be disjoint
We must be careful to ensure that if unifying nested lambda sets
results in disjoint lambdas, that the parent lambda sets are
ultimately treated disjointly as well.
Consider

```
  v1: {} -[ foo ({} -[ bar Str ]-> {}) ]-> {}
~ v2: {} -[ foo ({} -[ bar U64 ]-> {}) ]-> {}
```

When considering unification of the nested sets

```
  [ bar Str ]
~ [ bar U64 ]
```

we should not unify these sets, even disjointly, because that would
ultimately lead us to unifying

```
v1 ~ v2
=> {} -[ foo ({} -[ bar Str, bar U64 ]-> {}) ] -> {}
```

which is quite wrong - we do not have a lambda `foo` that captures
either `bar captures: Str` or `bar captures: U64`, we have two
different lambdas `foo` that capture different `bars`. The target
unification is

```
v1 ~ v2
=> {} -[ foo ({} -[ bar Str ]-> {}),
         foo ({} -[ bar U64 ]-> {}) ] -> {}
```

Closes #4712
2022-12-12 14:51:18 -06:00
Ayaz Hafiz
27dfe974df
Only print lambda ident names in types if they are ambiguous 2022-12-12 14:48:09 -06:00
Ayaz Hafiz
4cdb8c0cd7
Remove unused unification mismatches 2022-12-12 13:17:43 -06:00
Ayaz Hafiz
6adcaa2cbd
Extend ability symbol slice when merging in subs 2022-12-03 13:17:35 -08:00
Ayaz Hafiz
22a84c8b21
Add comment for is_function 2022-12-02 08:49:14 -06:00
Ayaz Hafiz
3605008fce
Update tests to check eq unbound float is resolved to dec 2022-12-01 11:41:42 -06:00
Ayaz Hafiz
eef51c9d87
Correct crash refs 2022-11-24 14:50:39 -06:00
Ayaz Hafiz
e2b30e5301
Constrain + solve crash 2022-11-24 14:46:50 -06:00
Ayaz Hafiz
9dc489c2b0
First pass constraining crash 2022-11-24 14:46:49 -06:00
Ayaz Hafiz
2ed2d88881
Do not run occurs checks when printing type variables
This is a hack. Let's find and correct these problems earlier in the
compiler.
2022-11-24 10:05:28 -05:00
Ayaz Hafiz
f8d51473d8
Report builtins type errors during load building as appropriate 2022-11-24 10:05:25 -05:00
Folkert
e7f3c6f281
inline dbg 2022-11-23 21:23:28 +01:00
Ayaz
1a3119e4c5
Merge pull request #4525 from roc-lang/fix-fixpoints-2
Implement fixpoint-fixing and unconditionally emplace variables into type indices
2022-11-19 17:47:02 -06:00
Ayaz
a74d7e14b7
Merge branch 'main' into i4416
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-11-17 09:07:00 -06:00
Ayaz Hafiz
716c4cb8e4
Print rigid name in debug representation 2022-11-16 17:09:31 -06:00
Ayaz Hafiz
735685dd86
Include error vars in is_recursion_var checks 2022-11-16 14:05:53 -06:00
Ayaz Hafiz
ce5ca4a93c
Mark emplace_variable as must_use 2022-11-16 14:05:52 -06:00
Ayaz Hafiz
27c2bd025d
Remove debug_assertions requirement 2022-11-16 14:05:51 -06:00
Ayaz Hafiz
9a7402f40b
Add Subs.dbg 2022-11-16 14:05:51 -06:00
Ayaz Hafiz
f7e0383058
Drop dead reference 2022-11-16 13:59:11 -06:00
Ayaz Hafiz
9c8a4ec027
Choose hash implementation for ranged number based on default width
Closes #4416
2022-11-16 13:57:03 -06:00
Ayaz Hafiz
af81ceae38
Add method to grab default compilation width of a number 2022-11-16 13:54:48 -06:00
Ayaz Hafiz
2d57aa2170
Use thread-local buffer for occurs check seen variables
This materially improves performance for programs that are
recursion-heavy (as most Roc programs will likely be).

```
$ hyperfine '/tmp/roc-old check examples/cli/cli-platform/Arg.roc' '/tmp/roc-new check examples/cli/cli-platform/Arg.roc' --warmup 10
Benchmark 1: /tmp/roc-old check examples/cli/cli-platform/Arg.roc
  Time (mean ± σ):      53.8 ms ±   1.3 ms    [User: 87.3 ms, System: 10.8 ms]
  Range (min … max):    52.2 ms …  60.4 ms    51 runs

Benchmark 2: /tmp/roc-new check examples/cli/cli-platform/Arg.roc
  Time (mean ± σ):      45.0 ms ±   1.6 ms    [User: 59.4 ms, System: 11.3 ms]
  Range (min … max):    42.6 ms …  49.8 ms    60 runs

Summary
  '/tmp/roc-new check examples/cli/cli-platform/Arg.roc' ran
    1.20 ± 0.05 times faster than '/tmp/roc-old check examples/cli/cli-platform/Arg.roc'
```

The time spent in `occurs` during checking for `Arg` drops from 50% to 23%.
2022-11-15 17:52:12 -06:00
Ayaz Hafiz
ce160f28a2
Chase under aliases during occurs checking
Closes #4368
2022-11-15 16:22:01 -06:00
Ayaz Hafiz
b30e8fc9b2
Remove Cells from Types 2022-11-15 09:00:16 -06:00
Ayaz Hafiz
f4fcb9f421
Fix Types types 2022-11-14 15:37:25 -06:00
Ayaz Hafiz
28f4b1ac56
Allow lints 2022-11-14 15:15:21 -06:00
Ayaz Hafiz
5564796927
SoA Types get variable emplacement (!)
We're now reaching the steady state we want to be closert to - when a
type is translated to a variable, emplace the variable we created for it
in the type index, so that types are never converted again!
2022-11-14 15:15:19 -06:00
Folkert
662bf1de99
more workspace dependencies 2022-11-13 16:10:02 +01:00
Ayaz Hafiz
54f4a70a0b
Explain evil 2022-11-11 21:16:23 -06:00
Ayaz Hafiz
a2e90c3709
Fix types SoA usage in solve 2022-11-11 21:16:23 -06:00
Ayaz Hafiz
6b5f632364
[skip-ci] Fix borrow issues in constraining 2022-11-11 21:16:22 -06:00
Ayaz Hafiz
59d2de5a55
Constrain with Types SoA, sans borrow checker 2022-11-11 21:16:05 -06:00
Ayaz Hafiz
6f6a90320e
Store types on ConstrainedModule 2022-11-11 21:16:01 -06:00
Ayaz Hafiz
80a05be8e5
Pretty-printer for debug representation of SoA types
```
[roc_load 0.0.1] [crates/compiler/solve/src/solve.rs:331] types.dbg(typ) = (`List.List` (`Num.U8`)), 68 -70->
[roc_load 0.0.1]   (`Decode.DecodeResult` 69
[roc_load 0.0.1]     ==> {result!: `Result.Result` 69 (`Decode.DecodeError` ==> [TooShort]73),
[roc_load 0.0.1]          rest!: `List.List` (`Num.U8`)})
```
2022-11-09 13:34:59 -06:00
Ayaz Hafiz
6071ef9696
Update use of Error tag 2022-11-08 14:12:45 -06:00
Ayaz Hafiz
28c3709ddf
Miscellaneous cleanup 2022-11-08 14:11:26 -06:00
Ayaz Hafiz
1b38cd0504
s/Type::Erroneous/Type::Error 2022-11-08 14:11:26 -06:00
Ayaz Hafiz
c1237215ea
Remove type Problem enum 2022-11-08 14:11:25 -06:00
Ayaz Hafiz
09748aec48
Remove problems from error type API surface 2022-11-08 14:11:25 -06:00
Ayaz Hafiz
b6322ff883
Report empty problems in translating to error type 2022-11-08 14:11:25 -06:00
Ayaz Hafiz
c4bd9fb79d
Remove problems from Subs 2022-11-08 14:11:25 -06:00
Ayaz Hafiz
281bc94b55
Remove FlatType::Erroneous 2022-11-08 14:11:25 -06:00