Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfirere committed Dec 4, 2024
1 parent 13494ca commit 32dbf8c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions jane/doc/extensions/uniqueness/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ type delayed_free = { id : int; callback : unit -> unit }
let get_id : delayed_free @ once -> int @ many = fun t -> t.id
```

We are working on a feature which will make it possible to use a value as `many`
if its type prevents it from containing a function. For example, you will then
be able to use an `int list @ once aliased` as `many` (but not as `unique`).
This mode-crossing works through container types. For example, you can use an
`int list @ once aliased` as `many` (but not as `unique`).

## Checking for Uniqueness

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/typing-layouts/allow_illegal_crossing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ Line 2, characters 10-18:
^^^^^^^^
Error: This expression has type "int ref"
but an expression was expected of type "('a : value mod uncontended)"
The kind of int ref is value.
The kind of int ref is mutable_data.
But the kind of int ref must be a subkind of value mod uncontended
because of the definition of f at line 1, characters 4-5.
|}]
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/typing-modal-kinds/basics.ml
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ let ref_immutable_data_right x =
Line 2, characters 30-53:
2 | take_strong_immutable_data (weaken_immutable_data x : float ref);
^^^^^^^^^^^^^^^^^^^^^^^
Error: This value is "once" but expected to be "many".
Error: This value is "contended" but expected to be "uncontended".
|}]

let ref_immutable_data_left x =
Expand All @@ -698,7 +698,7 @@ let ref_immutable_data_left x =
Line 3, characters 29-30:
3 | take_strong_immutable_data x
^
Error: This value is "once" but expected to be "many".
Error: This value is "contended" but expected to be "uncontended".
|}]

let float_immutable_data_right x =
Expand Down
7 changes: 1 addition & 6 deletions testsuite/tests/typing-unique/unique_documentation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,10 @@ val get_id : delayed_free @ once -> int = <fun>

type delayed_free = { ids : int list; callback : unit -> unit }

(* This does not work yet, but we expect it to work soon.
If you make it work, please update the uniqueness documentation. *)
let get_ids : delayed_free @ once -> int list @ many = fun d -> d.ids
[%%expect{|
type delayed_free = { ids : int list; callback : unit -> unit; }
Line 5, characters 64-69:
5 | let get_ids : delayed_free @ once -> int list @ many = fun d -> d.ids
^^^^^
Error: This value is "once" but expected to be "many".
val get_ids : delayed_free @ once -> int list = <fun>
|}]

let okay t =
Expand Down
3 changes: 3 additions & 0 deletions typing/typedecl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,9 @@ let narrow_to_manifest_jkind env loc decl =
| Error v -> raise (Error (loc, Jkind_mismatch_of_type (ty,v)))
end
end;
(* Just use [estimate_type_jkind], as [type_jkind] does effectful
expansion (bad) and [type_jkind_purely] is broken; see comments
on that function. *)
{ decl with type_jkind = Ctype.estimate_type_jkind env ty }

(* Check that the type expression (if present) is compatible with the kind.
Expand Down

0 comments on commit 32dbf8c

Please sign in to comment.