Skip to content

Commit

Permalink
parser now parses true/false directly into boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyhffong committed Dec 5, 2015
1 parent 30eaec9 commit 2063c0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/controls.jl
Expand Up @@ -149,10 +149,13 @@ function lintboolean( ex, ctx::LintContext )
if gt != Any && gt != Bool
msg( ctx, 2, "Variable " * string( ex ) * " has apparent non-Bool type." )
end
else
elseif typeof( ex ) != Bool
msg( ctx, 2, "Lint doesn't understand " * string( ex ) * " in a boolean context" )
end
lintexpr( ex, ctx )

if typeof( ex ) <: Expr || typeof( ex ) == Symbol
lintexpr( ex, ctx )
end
end

function lintcomparison( ex::Expr, ctx::LintContext )
Expand Down
10 changes: 10 additions & 0 deletions test/ifstmt.jl
Expand Up @@ -130,3 +130,13 @@ end
"""
msgs = lintstr(s )
@test( isempty( msgs ) )

s = """
1==1 && true
true && 1==1
1==1 || true || 1==1
1==1 || 1==1 || true
true || 1==1 || 1==1
"""
msgs = lintstr(s )
@test( isempty( msgs ) )

1 comment on commit 2063c0e

@tonyhffong
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.