Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Fix tests broken by 03a387a39ad1131b7d6cabeb5d4754c74164e9b7 #131

Merged
merged 1 commit into from
Sep 5, 2020
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
84 changes: 28 additions & 56 deletions tests/parsing/errors/expressions/__snapshots__/parse.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ let x = ((let a = 1 in let b = 2 in fun pattern -> (\\"test\\" : int))
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/ambiguousArrow.js:1:9-21

parsing/errors/expressions/ambiguousArrow.js:1:9-21
1 │ let a = b:int => \\"hi\\"
2 │
3 │ let x = {
Expand All @@ -20,8 +19,7 @@ let x = ((let a = 1 in let b = 2 in fun pattern -> (\\"test\\" : int))


Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/ambiguousArrow.js:6:3-23

parsing/errors/expressions/ambiguousArrow.js:6:3-23
4 │ let a = 1
5 │ let b = 2
6 │ a + b : int => \\"test\\"
Expand All @@ -43,8 +41,7 @@ let xs = x.map (fun key -> [|key;(predicates.(key))|])
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/array.js:2:44

parsing/errors/expressions/array.js:2:44
1 │ // missing ] before )
2 │ let xs = x.map(key => [key, predicates[key])
3 │
Expand All @@ -63,8 +60,7 @@ exports[`arrow.js 1`] = `
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/arrow.js:1:52

parsing/errors/expressions/arrow.js:1:52
1 │ Object.keys(providers).reduce((elements, providerId] => {
2 │ let x = 1
3 │ let b = 2
Expand Down Expand Up @@ -102,8 +98,7 @@ let pipeline =
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/block.js:14:4-15:1

parsing/errors/expressions/block.js:14:4-15:1
12 │
13 │ thisId === id
14 │ }
Expand All @@ -114,8 +109,7 @@ let pipeline =
Did you forget a \`)\` here?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/block.js:18:25-19:1

parsing/errors/expressions/block.js:18:25-19:1
16 │
17 │ let x = {
18 │ loop(0, Nil->push(doc)
Expand All @@ -126,8 +120,7 @@ let pipeline =
Did you forget a \`)\` here?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/block.js:22:11-23:1

parsing/errors/expressions/block.js:22:11-23:1
20 │
21 │ switch stack {
22 │ | Empty =>
Expand All @@ -138,8 +131,7 @@ let pipeline =
Looks like there might be an expression missing here

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/block.js:26:7-27:1

parsing/errors/expressions/block.js:26:7-27:1
24 │ | Join(doc1, doc2) =>
25 │ buffer->Buffer.add_string(indentation)
26 │ loop(
Expand All @@ -150,8 +142,7 @@ let pipeline =
Did you forget a \`)\` here?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/block.js:30:10-31:1

parsing/errors/expressions/block.js:30:10-31:1
28 │
29 │ let pipeline = switch scheduler {
30 │ | Some =>
Expand All @@ -175,17 +166,15 @@ let () = ((let open Foo in let exception End in x ())[@ns.braces ])
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/consecutive.res:1:23

parsing/errors/expressions/consecutive.res:1:23
1 │ let f = (a,b) => a + 3b;
2 │
3 │ let f = (g, h) => {

consecutive statements on a line must be separated by ';' or a newline

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/consecutive.res:4:7

parsing/errors/expressions/consecutive.res:4:7
2 │
3 │ let f = (g, h) => {
4 │ a + 3b
Expand All @@ -195,8 +184,7 @@ let () = ((let open Foo in let exception End in x ())[@ns.braces ])
consecutive expressions on a line must be separated by ';' or a newline

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/consecutive.res:8:16-27

parsing/errors/expressions/consecutive.res:8:16-27
6 │
7 │ let () = {
8 │ sideEffect1() sideEffect2()
Expand All @@ -206,8 +194,7 @@ let () = ((let open Foo in let exception End in x ())[@ns.braces ])
consecutive expressions on a line must be separated by ';' or a newline

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/consecutive.res:12:11-20

parsing/errors/expressions/consecutive.res:12:11-20
10 │
11 │ let () = {
12 │ open Foo exception End
Expand All @@ -227,17 +214,15 @@ let f a b = ((())[@ns.braces ])
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/emptyBlock.js:1:10

parsing/errors/expressions/emptyBlock.js:1:10
1 │ let x = {}
2 │
3 │ let f = (a, b) => {}

This let-binding misses an expression

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/emptyBlock.js:3:20

parsing/errors/expressions/emptyBlock.js:3:20
1 │ let x = {}
2 │
3 │ let f = (a, b) => {}
Expand All @@ -255,8 +240,7 @@ exports[`if.js 1`] = `
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/if.js:2:11-3:5

parsing/errors/expressions/if.js:2:11-3:5
1 │ // missing brace below
2 │ if (match)
3 │ let a = 1
Expand All @@ -281,8 +265,7 @@ exports[`ifLet.res 1`] = `
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/ifLet.res:1:1-3:1

parsing/errors/expressions/ifLet.res:1:1-3:1
1 │ if let Some(x) = result {
2 │ Js.log(\\"The sky is blue\\")
3 │ }
Expand All @@ -298,8 +281,7 @@ switch result {


Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/ifLet.res:7:8-11:1

parsing/errors/expressions/ifLet.res:7:8-11:1
5 │ if let Error(x) = result {
6 │ Js.log(\\"The sky is red\\")
7 │ } else if let Ok(y) = result {
Expand Down Expand Up @@ -332,8 +314,7 @@ module LicenseList = struct end
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/implementation.res:7:1

parsing/errors/expressions/implementation.res:7:1
5 │ }
6 │ }
7 │ }
Expand All @@ -352,8 +333,7 @@ let x = ([%rescript.exprhole ]) + 1
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/misc.js:1:9

parsing/errors/expressions/misc.js:1:9
1 │ let x = _ + 1
2 │

Expand All @@ -371,8 +351,7 @@ let record = { field = ([%rescript.exprhole ]) }
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/record.js:2:10-3:7

parsing/errors/expressions/record.js:2:10-3:7
1 │ let newWrapper = {
2 │ updateF
3 │ value: f(xWrapper.currentValue),
Expand All @@ -382,8 +361,7 @@ let record = { field = ([%rescript.exprhole ]) }
Did you forget a \`,\` here?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/record.js:8:10-18

parsing/errors/expressions/record.js:8:10-18
6 │
7 │ let newWrapper = {
8 │ updateF updateF2
Expand All @@ -393,8 +371,7 @@ let record = { field = ([%rescript.exprhole ]) }
Did you forget a \`:\` here?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/record.js:13:9-17:0

parsing/errors/expressions/record.js:13:9-17:0
11 │
12 │ let record = {
13 │ field:
Expand All @@ -417,8 +394,7 @@ exports[`setField.js 1`] = `
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/setField.js:4:30-5:1

parsing/errors/expressions/setField.js:4:30-5:1
2 │ let a = 1
3 │ // notice missing expression after =
4 │ m.left.compatibleTypeArgs =
Expand All @@ -438,8 +414,7 @@ exports[`taggedTemplateLiterals.js 1`] = `
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/taggedTemplateLiterals.js:1:1-5

parsing/errors/expressions/taggedTemplateLiterals.js:1:1-5
1 │ foo()\`null\`
2 │

Expand All @@ -455,8 +430,7 @@ let parsedPayload = try Js.Json.parseExn response with | _ -> Js.Json.null
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/try.js:2:37-38

parsing/errors/expressions/try.js:2:37-38
1 ┆ let parsedPayload =
2 ┆ try (Js.Json.parseExn(response)) {
3 ┆ | _ => Js.Json.null
Expand All @@ -475,8 +449,7 @@ let x = (\\"hi\\" : string)
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/unexpectedConstraint.js:4:3-13

parsing/errors/expressions/unexpectedConstraint.js:4:3-13
2 │ let a = 1
3 │ let b = 2
4 │ a + b : int
Expand All @@ -488,8 +461,7 @@ let x = (\\"hi\\" : string)


Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/expressions/unexpectedConstraint.js:7:9-20

parsing/errors/expressions/unexpectedConstraint.js:7:9-20
5 │ }
6 │
7 │ let x = \\"hi\\": string
Expand Down
24 changes: 8 additions & 16 deletions tests/parsing/errors/other/__snapshots__/parse.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ exports[`patternMatching.js 1`] = `
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/patternMatching.js:1:14-2:1

parsing/errors/other/patternMatching.js:1:14-2:1
1 │ switch expr {
2 │ }
3 │
Expand All @@ -31,8 +30,7 @@ type nonrec 'extraInfo student =
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/regionMissingComma.res:2:31

parsing/errors/other/regionMissingComma.res:2:31
1 │ external make: (
2 │ ~style: ReactDOMRe.Style.t=?.
3 │ ~image: bool=?,
Expand All @@ -41,8 +39,7 @@ type nonrec 'extraInfo student =
Did you forget a \`,\` here?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/regionMissingComma.res:8:11-9:11

parsing/errors/other/regionMissingComma.res:8:11-9:11
6 │ type student<'extraInfo> = {
7 │ name: string,
8 │ age: int
Expand All @@ -67,17 +64,15 @@ let x::y = myList
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/spread.js:1:12-14

parsing/errors/other/spread.js:1:12-14
1 │ let arr = [...x, ...y]
2 │ let [...arr, _] = [1, 2, 3]
3 │

Arrays can't use the \`...\` spread currently. Please use \`concat\` or other Array helpers.

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/spread.js:2:6-8

parsing/errors/other/spread.js:2:6-8
1 │ let arr = [...x, ...y]
2 │ let [...arr, _] = [1, 2, 3]
3 │
Expand All @@ -88,8 +83,7 @@ Explanation: such spread would create a subarray; out of performance concern, ou
Solution: if it's to validate the first few elements, use a \`when\` clause + Array size check + \`get\` checks on the current pattern. If it's to obtain a subarray, use \`Array.sub\` or \`Belt.Array.slice\`.

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/spread.js:4:21-23

parsing/errors/other/spread.js:4:21-23
2 │ let [...arr, _] = [1, 2, 3]
3 │
4 │ let record = {...x, ...y}
Expand All @@ -100,8 +94,7 @@ Solution: if it's to validate the first few elements, use a \`when\` clause + Ar
Explanation: since records have a known, fixed shape, a spread like \`{a, ...b}\` wouldn't make sense, as \`b\` would override every field of \`a\` anyway.

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/spread.js:5:15-18

parsing/errors/other/spread.js:5:15-18
3 │
4 │ let record = {...x, ...y}
5 │ let {...x, ...y} = myRecord
Expand All @@ -113,8 +106,7 @@ Explanation: you can't collect a subset of a record's field into its own record,
Solution: you need to pull out each field you want explicitly.

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/other/spread.js:8:13-22

parsing/errors/other/spread.js:8:13-22
6 │
7 │ let myList = list{...x, ...y}
8 │ let list{...x, ...y} = myList
Expand Down
12 changes: 4 additions & 8 deletions tests/parsing/errors/pattern/__snapshots__/parse.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ let 4 = for [%rescript.patternhole ] = 0 to 10 do Js.log \\"for\\" done
=====Errors=============================================

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/pattern/missing.res:1:5

parsing/errors/pattern/missing.res:1:5
1 │ let = 2
2 │ let = 4
3 │

I was expecting a name for this let-binding. Example: \`let message = \\"hello\\"\`

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/pattern/missing.res:2:5

parsing/errors/pattern/missing.res:2:5
1 │ let = 2
2 │ let = 4
3 │
Expand All @@ -27,8 +25,7 @@ let 4 = for [%rescript.patternhole ] = 0 to 10 do Js.log \\"for\\" done
I was expecting a name for this let-binding. Example: \`let message = \\"hello\\"\`

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/pattern/missing.res:4:5-6

parsing/errors/pattern/missing.res:4:5-6
2 │ let = 4
3 │
4 │ for in 0 to 10 {
Expand All @@ -38,8 +35,7 @@ let 4 = for [%rescript.patternhole ] = 0 to 10 do Js.log \\"for\\" done
A for-loop has the following form: \`for i in 0 to 10\`. Did you forget to supply a name before \`in\`?

Syntax error!
/Users/mvalcke/Development/syntax/tests/parsing/errors/pattern/missing.res:9:3-4

parsing/errors/pattern/missing.res:9:3-4
7 │
8 │ switch x {
9 │ | => ()
Expand Down
Loading