Skip to content

Commit 37cf473

Browse files
committed
Update warnings
1 parent 5fe9a22 commit 37cf473

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

lib/live_view_native/swiftui/rules_parser.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ defmodule LiveViewNative.SwiftUI.RulesParser do
1111
line = Keyword.get(opts, :line) || 1
1212
variable_context = Keyword.get(opts, :variable_context, Elixir)
1313
expect_semicolons? = Keyword.get(opts, :expect_semicolons?, false)
14-
expect_semicolons? = true
1514

1615
context =
1716
opts

lib/live_view_native/swiftui/rules_parser/parser/error.ex

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,27 @@ defmodule LiveViewNative.SwiftUI.RulesParser.Parser.Error do
140140

141141
header =
142142
if error.is_warning? do
143-
""
143+
"#{error_message}#{maybe_but_got}"
144144
else
145145
"Unsupported input:"
146146
end
147147

148+
footer =
149+
if error.is_warning? do
150+
""
151+
else
152+
"""
153+
154+
#{error_message}#{maybe_but_got}
155+
"""
156+
end
157+
148158
message = """
149159
#{header}
150160
#{line_spacer} |
151161
#{lines}
152162
#{line_spacer} |
153-
154-
#{error_message}#{maybe_but_got}
163+
#{footer}
155164
"""
156165

157166
{message, {source_line, 0}, error.byte_offset}

test/live_view_native/swiftui/rules_parser_test.exs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule LiveViewNative.SwiftUI.RulesParserTest do
3232
end
3333

3434
test "parses modifier function definition with annotation (2)" do
35-
{line, input} = {__ENV__.line,"""
35+
{line, input} = {__ENV__.line + 1,"""
3636
font(.largeTitle)
3737
bold(true)
3838
italic(true)
@@ -467,24 +467,20 @@ defmodule LiveViewNative.SwiftUI.RulesParserTest do
467467

468468
assert logs =~
469469
"""
470-
warning:#{" "}
470+
warning: Expected a ‘;’
471471
|
472472
1 | blue()‎ red()
473473
| ^
474474
|
475-
476-
Expected a ‘;’
477475
"""
478476

479477
assert logs =~
480478
"""
481-
warning:#{" "}
479+
warning: Expected a ‘;’
482480
|
483481
1 | blue() red()‎
484482
| ^
485483
|
486-
487-
Expected a ‘;’
488484
"""
489485

490486
input = """
@@ -500,34 +496,28 @@ defmodule LiveViewNative.SwiftUI.RulesParserTest do
500496

501497
assert logs =~
502498
"""
503-
warning:#{" "}
499+
warning: Expected a ‘;’
504500
|
505501
1 | blue()‎
506502
| ^
507503
|
508-
509-
Expected a ‘;’
510504
"""
511505
assert logs =~
512506
"""
513-
warning:#{" "}
507+
warning: Expected a ‘;’
514508
|
515509
2 | red()‎
516510
| ^
517511
|
518-
519-
Expected a ‘;’
520512
"""
521513

522514
assert logs =~
523515
"""
524-
warning:#{" "}
516+
warning: Expected a ‘;’
525517
|
526518
3 | green()‎
527519
| ^
528520
|
529-
530-
Expected a ‘;’
531521
"""
532522
end
533523

0 commit comments

Comments
 (0)