Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ object SjsonnetTestMain {
"unicode",
"unix_line_endings",
"unparse",
"verbatim_strings"
"verbatim_strings",
"issue_127"
// disabled because it spams the console a lot
// "stdlib"
)
Expand Down
2 changes: 1 addition & 1 deletion sjsonnet/src/sjsonnet/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class Parser(val currentFile: Path) {
def bind[_: P] =
P( Pos ~~ id ~ ("(" ~/ params.? ~ ")").?.map(_.flatten).map(_.getOrElse(null)) ~ "=" ~ expr ).map(Expr.Bind.tupled)

def args[_: P] = P( ((id ~ "=").? ~ expr).rep(sep = ",") ~ ",".? ).flatMapX{ x =>
def args[_: P] = P( ((id ~ "=" ~ !"=").? ~ expr).rep(sep = ",") ~ ",".? ).flatMapX{ x =>
if (x.sliding(2).exists{case Seq(l, r) => l._1.isDefined && r._1.isEmpty case _ => false}) {
Fail.opaque("no positional params after named params")
} else {
Expand Down
6 changes: 6 additions & 0 deletions sjsonnet/test/resources/test_suite/issue_127.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
local myFunc = function(a)
if (a) then "a" else "b";

local b = "aaa";

std.assertEqual(myFunc(b == [] || b == ['e']), "b")
1 change: 1 addition & 0 deletions sjsonnet/test/src-jvm-native/sjsonnet/FileTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ object FileTests extends TestSuite{
test("unix_line_endings") - checkGolden()
test("unparse") - checkGolden()
test("verbatim_strings") - check()
test("issue_127") - check()
}
}