Skip to content

Commit 10ed9f9

Browse files
committed
Remove redundant comments in descr.ex and simplify subtype tests in descr_test.ex for clarity and maintainability.
1 parent 3d7cf8e commit 10ed9f9

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

lib/elixir/lib/module/types/descr.ex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,9 +1197,6 @@ defmodule Module.Types.Descr do
11971197
# 2. **arrows**: List of lists, where each inner list contains an intersection of function arrows
11981198
# 3. **arity**: Function arity (number of parameters)
11991199
#
1200-
# This canonical form simplifies operations like function application, domain calculation,
1201-
# and subtyping checks by properly handling arrow intersections and negations.
1202-
#
12031200
## Return Values
12041201
#
12051202
# - `{domain, arrows, arity}` for valid function BDDs

lib/elixir/test/elixir/module/types/descr_test.exs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,8 @@ defmodule Module.Types.DescrTest do
644644
refute subtype?(fun([], term()), fun([], float()))
645645

646646
# Contravariance of domain
647-
union_args = fun([union(integer(), atom())], boolean())
648-
int_arg = fun([integer()], boolean())
649-
atom_arg = fun([atom()], boolean())
650-
651-
assert subtype?(union_args, int_arg)
652-
assert subtype?(intersection(int_arg, atom_arg), union_args)
653-
refute subtype?(atom_arg, union_args)
647+
assert subtype?(fun([integer()], boolean()), fun([number()], boolean()))
648+
refute subtype?(fun([number()], boolean()), fun([integer()], boolean()))
654649

655650
# Nested function types
656651
higher_order = fun([fun([integer()], atom())], boolean())
@@ -659,17 +654,14 @@ defmodule Module.Types.DescrTest do
659654
assert subtype?(higher_order, specific)
660655
refute subtype?(specific, higher_order)
661656

662-
## Special multi-arity test
657+
## Multi-arity
663658
f = fun([none(), integer()], atom())
664659
assert subtype?(f, f)
665660
assert subtype?(f, fun([none(), integer()], term()))
666-
667661
assert subtype?(fun([none(), number()], atom()), f)
668662
assert subtype?(fun([tuple(), number()], atom()), f)
669-
670663
refute subtype?(fun([none(), float()], atom()), f)
671664
refute subtype?(fun([pid(), float()], atom()), f)
672-
673665
# A function with the wrong arity is refused
674666
refute subtype?(fun([none()], atom()), f)
675667
end

0 commit comments

Comments
 (0)