Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purged null from Hy #889

Merged
merged 1 commit into from
Aug 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eg/debian/parse-rfc822.hy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
(defn parse-rfc822-stream [fd]
"Parse an RFC822 stream"
(setv bits {})
(setv key null)
(setv key None)
(for [line fd]
(if (in ":" line)
(do (setv line (.split line ":" 1))
Expand Down
2 changes: 1 addition & 1 deletion hy/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def load_stdlib():
# keywords in Python 3.*
def _is_hy_builtin(name, module_name):
extras = ['True', 'False', 'None',
'true', 'false', 'nil', 'null']
'true', 'false', 'nil']
if name in extras or keyword.iskeyword(name):
return True
# for non-Hy modules, check for pre-existing name in
Expand Down
1 change: 0 additions & 1 deletion hy/lex/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ def t_identifier(p):
"true": "True",
"false": "False",
"nil": "None",
"null": "None",
}

if obj in table:
Expand Down
4 changes: 2 additions & 2 deletions tests/compilers/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ def test_ast_good_defclass():
def test_ast_bad_defclass():
"Make sure AST can't compile invalid defclass"
cant_compile("(defclass)")
cant_compile("(defclass a null)")
cant_compile("(defclass a null null)")
cant_compile("(defclass a None)")
cant_compile("(defclass a None None)")


def test_ast_good_lambda():
Expand Down
4 changes: 1 addition & 3 deletions tests/native_tests/language.hy
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(setv nil 1))
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(setv null 1))
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(defn defclass [] (print "hello")))
(except [e [TypeError]] (assert (in "Can't assign to a builtin" (str e)))))
(try (eval '(defn get [] (print "hello")))
Expand Down Expand Up @@ -228,7 +226,7 @@
"NATIVE: test if cond sorta works."
(cond
[(= 1 2) (assert (is true false))]
[(is null null) (setv x true) (assert x)]))
[(is None None) (setv x true) (assert x)]))


(defn test-index []
Expand Down
4 changes: 2 additions & 2 deletions tests/native_tests/unless.hy
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
(assert (= (unless false 1) 1))
(assert (= (unless false 1 2) 2))
(assert (= (unless false 1 3) 3))
(assert (= (unless true 2) null))
(assert (= (unless true 2) None))
(assert (= (unless true 2) nil))
(assert (= (unless (!= 1 2) 42) null))
(assert (= (unless (!= 1 2) 42) None))
(assert (= (unless (!= 1 2) 42) nil))
(assert (= (unless (!= 2 2) 42) 42)))
4 changes: 2 additions & 2 deletions tests/native_tests/when.hy
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
(assert (= (when true 1) 1))
(assert (= (when true 1 2) 2))
(assert (= (when true 1 3) 3))
(assert (= (when false 2) null))
(assert (= (when (= 1 2) 42) null))
(assert (= (when false 2) None))
(assert (= (when (= 1 2) 42) None))
(assert (= (when false 2) nil))
(assert (= (when (= 1 2) 42) nil))
(assert (= (when (= 2 2) 42) 42)))