Skip to content

Commit

Permalink
Minor makefile fixes (#3620)
Browse files Browse the repository at this point in the history
* fixes

* Support `value_or_null` in `list` and `option` (#3623)

* `value_or_null` arguments to `list` and `option`

* Tests

* Accept tests

---------

Co-authored-by: Diana Kalinichenko <[email protected]>

---------

Co-authored-by: Diana Kalinichenko <[email protected]>
  • Loading branch information
dkalinichenko-js and d-kalinichenko authored Feb 25, 2025
1 parent 0fc831f commit 62a931d
Show file tree
Hide file tree
Showing 22 changed files with 398 additions and 194 deletions.
4 changes: 2 additions & 2 deletions Makefile.common-jst
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ install_for_test: _install
rm -rf _runtest
mkdir _runtest
ln -s ../_install _runtest/_install
$(cpl) -a $(ocamldir)/testsuite _runtest/testsuite
# Use rsync to ensure hardlinks are created on both Linux and macOS
rsync --link-dest=../../$(ocamldir)/testsuite/ -a $(ocamldir)/testsuite/ _runtest/testsuite/
# replace backend-specific testsuite/tools with their new versions
rm -f _runtest/testsuite/tools/*
cp -a flambda-backend/testsuite/tools/* _runtest/testsuite/tools/
Expand Down Expand Up @@ -300,7 +301,6 @@ install_for_test: _install
for universe in upstream_compatible stable beta alpha ; do \
mkdir -p otherlibs/{stdlib_,}$${universe}; \
$(cpl) stdlib/stdlib_$${universe}/* otherlibs/stdlib_$${universe}; \
$(cpl) stdlib/$${universe}/* otherlibs/$${universe}; \
done; \
if [[ x"$(RUNTIME_DIR)" = x"runtime" ]]; then \
$(cpl) stdlib/runtime_events/{lib,}runtime_events* otherlibs/runtime_events; \
Expand Down
16 changes: 8 additions & 8 deletions testsuite/tests/typing-layouts-bits32/parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,47 @@ type t = int32# list;;
Line 1, characters 9-15:
1 | type t = int32# list;;
^^^^^^
Error: This type "int32#" should be an instance of type "('a : value)"
Error: This type "int32#" should be an instance of type "('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
But the layout of int32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

let f (_ : int32# list) = ();;
[%%expect {|
Line 1, characters 11-17:
1 | let f (_ : int32# list) = ();;
^^^^^^
Error: This type "int32#" should be an instance of type "('a : value)"
Error: This type "int32#" should be an instance of type "('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
But the layout of int32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C of int32# list;;
[%%expect {|
Line 1, characters 14-20:
1 | type t = C of int32# list;;
^^^^^^
Error: This type "int32#" should be an instance of type "('a : value)"
Error: This type "int32#" should be an instance of type "('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
But the layout of int32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C : int32# list -> t;;
[%%expect {|
Line 1, characters 13-19:
1 | type t = C : int32# list -> t;;
^^^^^^
Error: This type "int32#" should be an instance of type "('a : value)"
Error: This type "int32#" should be an instance of type "('a : value_or_null)"
The layout of int32# is bits32
because it is the primitive type int32#.
But the layout of int32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

(* Syntax: int32#c
Expand Down
16 changes: 8 additions & 8 deletions testsuite/tests/typing-layouts-bits64/parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,47 @@ type t = int64# list;;
Line 1, characters 9-15:
1 | type t = int64# list;;
^^^^^^
Error: This type "int64#" should be an instance of type "('a : value)"
Error: This type "int64#" should be an instance of type "('a : value_or_null)"
The layout of int64# is bits64
because it is the primitive type int64#.
But the layout of int64# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

let f (_ : int64# list) = ();;
[%%expect {|
Line 1, characters 11-17:
1 | let f (_ : int64# list) = ();;
^^^^^^
Error: This type "int64#" should be an instance of type "('a : value)"
Error: This type "int64#" should be an instance of type "('a : value_or_null)"
The layout of int64# is bits64
because it is the primitive type int64#.
But the layout of int64# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C of int64# list;;
[%%expect {|
Line 1, characters 14-20:
1 | type t = C of int64# list;;
^^^^^^
Error: This type "int64#" should be an instance of type "('a : value)"
Error: This type "int64#" should be an instance of type "('a : value_or_null)"
The layout of int64# is bits64
because it is the primitive type int64#.
But the layout of int64# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C : int64# list -> t;;
[%%expect {|
Line 1, characters 13-19:
1 | type t = C : int64# list -> t;;
^^^^^^
Error: This type "int64#" should be an instance of type "('a : value)"
Error: This type "int64#" should be an instance of type "('a : value_or_null)"
The layout of int64# is bits64
because it is the primitive type int64#.
But the layout of int64# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

(* Syntax: int64#c
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/typing-layouts-err-msg/value.ml
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ Line 1, characters 21-22:
1 | let f (x: t_void) = [x]
^
Error: This expression has type "t_void" but an expression was expected of type
"('a : value)"
"('a : value_or_null)"
The layout of t_void is void
because of the definition of t_void at line 6, characters 0-19.
But the layout of t_void must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

(* Tuple *)
Expand Down
16 changes: 8 additions & 8 deletions testsuite/tests/typing-layouts-float32/parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,47 @@ type t = float32# list;;
Line 1, characters 9-17:
1 | type t = float32# list;;
^^^^^^^^
Error: This type "float32#" should be an instance of type "('a : value)"
Error: This type "float32#" should be an instance of type "('a : value_or_null)"
The layout of float32# is float32
because it is the primitive type float32#.
But the layout of float32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

let f (_ : float32# list) = ();;
[%%expect {|
Line 1, characters 11-19:
1 | let f (_ : float32# list) = ();;
^^^^^^^^
Error: This type "float32#" should be an instance of type "('a : value)"
Error: This type "float32#" should be an instance of type "('a : value_or_null)"
The layout of float32# is float32
because it is the primitive type float32#.
But the layout of float32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C of float32# list;;
[%%expect {|
Line 1, characters 14-22:
1 | type t = C of float32# list;;
^^^^^^^^
Error: This type "float32#" should be an instance of type "('a : value)"
Error: This type "float32#" should be an instance of type "('a : value_or_null)"
The layout of float32# is float32
because it is the primitive type float32#.
But the layout of float32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C : float32# list -> t;;
[%%expect {|
Line 1, characters 13-21:
1 | type t = C : float32# list -> t;;
^^^^^^^^
Error: This type "float32#" should be an instance of type "('a : value)"
Error: This type "float32#" should be an instance of type "('a : value_or_null)"
The layout of float32# is float32
because it is the primitive type float32#.
But the layout of float32# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

(* Syntax: float32#c
Expand Down
16 changes: 8 additions & 8 deletions testsuite/tests/typing-layouts-float64/parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,47 +29,47 @@ type t = float# list;;
Line 1, characters 9-15:
1 | type t = float# list;;
^^^^^^
Error: This type "float#" should be an instance of type "('a : value)"
Error: This type "float#" should be an instance of type "('a : value_or_null)"
The layout of float# is float64
because it is the primitive type float#.
But the layout of float# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

let f (_ : float# list) = ();;
[%%expect {|
Line 1, characters 11-17:
1 | let f (_ : float# list) = ();;
^^^^^^
Error: This type "float#" should be an instance of type "('a : value)"
Error: This type "float#" should be an instance of type "('a : value_or_null)"
The layout of float# is float64
because it is the primitive type float#.
But the layout of float# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C of float# list;;
[%%expect {|
Line 1, characters 14-20:
1 | type t = C of float# list;;
^^^^^^
Error: This type "float#" should be an instance of type "('a : value)"
Error: This type "float#" should be an instance of type "('a : value_or_null)"
The layout of float# is float64
because it is the primitive type float#.
But the layout of float# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

type t = C : float# list -> t;;
[%%expect {|
Line 1, characters 13-19:
1 | type t = C : float# list -> t;;
^^^^^^
Error: This type "float#" should be an instance of type "('a : value)"
Error: This type "float#" should be an instance of type "('a : value_or_null)"
The layout of float# is float64
because it is the primitive type float#.
But the layout of float# must be a sublayout of value
because the type argument of list has layout value.
because the type argument of list has layout value_or_null.
|}];;

(* Syntax: float#c
Expand Down
71 changes: 0 additions & 71 deletions testsuite/tests/typing-layouts-or-null/array.ml

This file was deleted.

Loading

0 comments on commit 62a931d

Please sign in to comment.