Skip to content

Commit 2f76fde

Browse files
committed
Undo fmap of None is None
Closes #692.
1 parent ad48865 commit 2f76fde

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

coconut/compiler/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ def leading_whitespace(self, inputstring):
12901290
return "".join(leading_ws)
12911291

12921292
def ind_proc(self, inputstring, **kwargs):
1293-
"""Process indentation and ensures balanced parentheses."""
1293+
"""Process indentation and ensure balanced parentheses."""
12941294
lines = tuple(logical_lines(inputstring))
12951295
new = [] # new lines
12961296
current = None # indentation level of previous line

coconut/compiler/templates/header.py_template

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,8 +1384,6 @@ def fmap(func, obj, **kwargs):
13841384
starmap_over_mappings = kwargs.pop("starmap_over_mappings", False)
13851385
if kwargs:
13861386
raise _coconut.TypeError("fmap() got unexpected keyword arguments " + _coconut.repr(kwargs))
1387-
if obj is None:
1388-
return None
13891387
obj_fmap = _coconut.getattr(obj, "__fmap__", None)
13901388
if obj_fmap is not None:
13911389
try:

coconut/tests/src/cocotest/agnostic/main.coco

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ def main_test() -> bool:
12611261
assert cartesian_product(v, v).count((2, 1)) == 1 == cartesian_product(v, repeat=2).count((2, 1))
12621262
assert cartesian_product(v, v).count((2, 0)) == 0 == cartesian_product(v, repeat=2).count((2, 0))
12631263
assert not range(0, 0)
1264-
assert None |> fmap$(.+1) is None
1264+
assert_raises(const None ..> fmap$(.+1), TypeError)
12651265
xs = [1] :: [2]
12661266
assert xs |> list == [1, 2] == xs |> list
12671267
ys = (_ for _ in range(2)) :: (_ for _ in range(2))

0 commit comments

Comments
 (0)