Commit Graph

3401 Commits

Author SHA1 Message Date
Ayaz Hafiz
5efdecafc9
Constrain flex inference variables without re-generalization
When constraining a recursive function like

```
f : _ -> {}
f : \_ -> f {}
```

our first step is to solve the value type of `f` relative to its
annotation. We have to be careful that the inference variable in the
signature of `f` is not generalized until after the body of `f` is
solved. Otherwise, we end up admitting polymorphic recursion.
2022-11-24 10:05:25 -05:00
Ayaz Hafiz
f8d51473d8
Report builtins type errors during load building as appropriate 2022-11-24 10:05:25 -05:00
Brian Carroll
bcb423dae8
wasm_interp: remove unsafe code 2022-11-24 10:05:25 -05:00
Brian Carroll
f5976d57df
clippy + comments 2022-11-24 10:05:25 -05:00
Brian Carroll
219de53ccb
wasm_interp: Tests for ExecutionState 2022-11-24 10:05:24 -05:00
Brian Carroll
35275299e3
wasm_module: create WasmModule::new for testing 2022-11-24 10:05:24 -05:00
Brian Carroll
45556b95bd
wasm_interp: create execute module 2022-11-24 10:05:24 -05:00
Brian Carroll
ae4131d3ac
wasm_interp: tests for ValueStack 2022-11-24 10:05:24 -05:00
Brian Carroll
ee7e439602
wasm_interp: tests for call_stack 2022-11-24 10:05:24 -05:00
Brian Carroll
43af215417
wasm_interp: create call_stack module 2022-11-24 10:05:24 -05:00
Brian Carroll
fb13992ccd
wasm_interp: new crate, with a value_stack module 2022-11-24 10:05:23 -05:00
Brian Carroll
8ddc575600
Use workspace versioning for wasm_module Cargo.toml 2022-11-24 10:05:23 -05:00
Folkert
5cb47939e2
don't try to run dbg with roc run 2022-11-24 11:19:41 +01:00
Richard Feldman
adddc1ff70
Fix dbg parse test 2022-11-24 03:31:19 -05:00
Folkert
51c018b03c
fix compile error in tests 2022-11-23 23:24:53 +01:00
Folkert
1875176319
improve formatting 2022-11-23 23:16:37 +01:00
Folkert
e44a8a9eed
print all the relevant info 2022-11-23 22:58:58 +01:00
Folkert
e7f3c6f281
inline dbg 2022-11-23 21:23:28 +01:00
Folkert
dcb530d3af
Revert "toplevel debug"
This reverts commit 5ea8d96f3e.
2022-11-23 20:29:55 +01:00
Folkert
5ea8d96f3e
toplevel debug 2022-11-23 20:29:45 +01:00
Richard Feldman
928495072c
Add dbg to sort_can_defs 2022-11-22 21:37:39 -05:00
Richard Feldman
73a591743b
Add parser tests for dbg 2022-11-22 21:27:10 -05:00
Richard Feldman
49f8768271
Parse and format dbg 2022-11-22 21:08:26 -05:00
Ayaz
ef5d83a42d
Merge pull request #4556 from roc-lang/fix-fixpoint-fixing
Correct when fixpoint-fixed type variables can be reunified
2022-11-21 17:44:06 -06:00
Ayaz Hafiz
e1afd964c7
Correct when fixpoint-fixed type variables can be reunified
With fixpoint-fixing, we don't want to re-unify type variables that were
just fixed, because doing so may change their shapes in ways that we
explicitly just set them up not to be changed (as fixpoint-fixing
clobbers type variable contents).

However, this restriction need only apply when we re-unify two type
variables that were both involved in the same fixpoint-fixing cycle. If
we have a type variable T that was involved in fixpoint-fixing, and we
unify it with U that wasn't, we know that the $U \notin \bar{T}$, where
$\bar{T}$ is the recursive closure of T. In these cases, we do want to
permit the usual in-band unification of $T \sim U$.
2022-11-21 15:57:36 -06:00
Brian Carroll
9353c25826
formatting 2022-11-21 19:51:21 +00:00
Brian Carroll
880ef2704c
Merge branch 'main' of github.com:rtfeldman/roc into wasm_module_crate 2022-11-21 19:49:00 +00:00
Brian Carroll
a35e912c0a
Fix wasm repl tests 2022-11-21 19:48:38 +00:00
Brian Carroll
a3cfdd478d
rename called_preload_fns to called_fns 2022-11-21 19:48:02 +00:00
Anton-4
f32e329798
Merge pull request #4549 from roc-lang/editor_design_docs
improve/expand design docs for editor and plugins
2022-11-21 09:13:58 +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
Anton-4
d2959e95c2
improve/expand design docs 2022-11-19 18:27:09 +01:00
Folkert de Vries
3e0176a717
Merge pull request #4541 from roc-lang/fix-echo
Fix warnings on examples/cli/echo.roc
2022-11-19 14:46:14 +01:00
Richard Feldman
200d456b7b
Create single source of favicon truth 2022-11-19 06:23:46 -05:00
Joshua Warner
2d9aba2242
Refactor parser methods to not return State as part of ParseError
As previously discovered with #4464, it's easy to accidentally mis-use the State value returned on the Err path.

There were mixed assumptions about what that State represents: (1) the State where the error occurred, or (2) the State at the beginning of the thing we were just parsing.

I fixed this up to always mean (2) - at which point we don't actually need to return the State at all - so it's impossible for further discrepency to creep in.

I also took the liberty to refactor a few more methods to be purely combinator-based, rather than calling `parse` directly.
2022-11-18 19:52:23 -05:00
Richard Feldman
e2b6d93096
Use debug_assert_eq! instead of debug_assert! 2022-11-18 14:01:51 -05:00
Ayaz Hafiz
bbaa9299f1
Update cli tests 2022-11-17 17:21:38 -06:00
Brian Carroll
c16d425936
Merge branch 'main' of github.com:roc-lang/roc into wasm_module_crate 2022-11-17 21:29:59 +00:00
Brian Carroll
29baa45774
debug generated linker data for Roc->JS calls 2022-11-17 21:26:33 +00: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
2836e0a9e9
Merge pull request #4534 from roc-lang/fix-able-binding-variables-behind-aliases
Ensure ability-bound variables are registered in their generalization pool
2022-11-17 07:45:49 -06:00
Richard Feldman
a8ee5b7cbf
Merge pull request #4537 from roc-lang/output-tweaks
Reporting tweaks
2022-11-17 08:28:57 -05:00
Brian Carroll
24e6e8445d
Remove the trick of pushing an extra N+1 entry to function_offsets. It's bug-prone. 2022-11-17 07:49:38 +00:00
Richard Feldman
6c4e2c8738
Revise wording on unnecessary wildcard warning
My concern with the previous wording is that:
- Beginners will be confused by "these are always open"
- Users advanced enough to understand what that actually means won't benefit from seeing it in this warning message!
2022-11-16 23:18:51 -05:00
Richard Feldman
2f54e46909
Add a blank line after failed inline expectations 2022-11-16 23:11:05 -05:00
Richard Feldman
1e4cf52fd4
Merge pull request #4504 from roc-lang/fix-styles
Fix some web styles
2022-11-16 21:53:05 -05:00
Ayaz Hafiz
fe0eacb70a
Propogate only_unseen phanton type count check 2022-11-16 19:46:54 -06:00
Ayaz Hafiz
48c0921cd2
Fix off by one conditional 2022-11-16 19:15:22 -06:00
Ayaz Hafiz
b43078440f
Ensure ability-bound variables are registered in their generalization pool
When we attempt to bind a type argument to an ability in an alias/opaque
instantiation, we create a fresh flex var to represent satisfaction of
the ability, and then unify the type argument with that flex var.
Previously, we did not register this fresh var in the appropriate rank
pool.

Usually this is not a problem; however, our generalization algorithm is
such that we skip adjusting the rank of redundant variables. Redundant
variables are those that are in the same unification tree, but are not
the root of the unification trees.

This means that if such a flex able var becomes the root of a
unification tree with the type argument, and the type argument is itself
generalized, we will have missed generalization of the argument.

The fix is simple - make sure to register the flex able var into the
appropriate rank pool.

Closes #4408
2022-11-16 17:09:47 -06:00
Ayaz Hafiz
716c4cb8e4
Print rigid name in debug representation 2022-11-16 17:09:31 -06:00