Skip to content
Open
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 lib/ast.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ast.ls
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@ class exports.Binary extends Node
return @compileRegexEquals o, that
if @op is \=== and (@first instanceof Literal and @second instanceof Literal)
and @first.is-what! isnt @second.is-what!
and \.. not in [@first.value, @second.value]
@warn "strict comparison of two different types will always be false: #{@first.value} == #{@second.value}" unless o.no-warn
return @compileChain o if COMPARER.test @op and COMPARER.test @second.op
@first <<< {@front}
Expand Down
12 changes: 12 additions & 0 deletions test/compilation.ls
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,15 @@ LiveScript.compile '''
d
.e (.f in [2 3])
'''


# testing warnings: start
old-warn = console.warn
console.warn = -> fail "Expected no warnings. Got: #it"

# [LiveScript#1037](https://github.com/gkz/LiveScript/pull/1037)
# This code should produce no compilation warnings
LiveScript.compile '1 => .. == 1; 1 == ..'

# testing warnings: end
console.warn = old-warn