Skip to content

Commit e7ddf82

Browse files
committed
Fix purescript#2149, remove support for = in ObjectBinder (purescript#2152)
* Fix purescript#2149, remove support for = in ObjectBinder * Extended matches must specify a binder
1 parent ddd8101 commit e7ddf82

File tree

8 files changed

+15
-16
lines changed

8 files changed

+15
-16
lines changed

examples/passing/LiberalTypeSynonyms.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ type F r = { | r } -> { | r }
1717

1818
f :: (forall r. F r) -> String
1919
f g = case g { x: "Hello" } of
20-
{ x = x } -> x
20+
{ x: x } -> x
2121

2222
main = log "Done"

examples/passing/NamedPatterns.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Prelude
44
import Control.Monad.Eff.Console (log)
55

66
foo = \x -> case x of
7-
y@{ foo = "Foo" } -> y
7+
y@{ foo: "Foo" } -> y
88
y -> y
99

1010
main = log "Done"

examples/passing/ObjectUpdate.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ update2 :: forall r. { foo :: String | r } -> { foo :: String | r }
99
update2 = \o -> o { foo = "Foo" }
1010

1111
replace = \o -> case o of
12-
{ foo = "Foo" } -> o { foo = "Bar" }
13-
{ foo = "Bar" } -> o { bar = "Baz" }
12+
{ foo: "Foo" } -> o { foo = "Bar" }
13+
{ foo: "Bar" } -> o { bar = "Baz" }
1414
o -> o
1515

1616
polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }

examples/passing/Objects.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test4 = test2 weirdObj
2626
weirdObj = { "!@#": 1.0 }
2727

2828
test5 = case { "***": 1.0 } of
29-
{ "***" = n } -> n
29+
{ "***": n } -> n
3030

3131
test6 = case { "***": 1.0 } of
3232
{ "***": n } -> n

examples/passing/Patterns.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Prelude
44
import Control.Monad.Eff.Console (log)
55

66
test = \x -> case x of
7-
{ str = "Foo", bool = true } -> true
8-
{ str = "Bar", bool = b } -> b
7+
{ str: "Foo", bool: true } -> true
8+
{ str: "Bar", bool: b } -> b
99
_ -> false
1010

1111
f = \o -> case o of
12-
{ foo = "Foo" } -> o.bar
12+
{ foo: "Foo" } -> o.bar
1313
_ -> 0
1414

1515
h = \o -> case o of

examples/passing/Rank2Object.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ import Control.Monad.Eff.Console
66
data Foo = Foo { id :: forall a. a -> a }
77

88
foo :: Foo -> Number
9-
foo (Foo { id = f }) = f 0.0
9+
foo (Foo { id: f }) = f 0.0
1010

1111
main = log "Done"

examples/passing/ReservedWords.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ p :: { type :: String }
1212
p = o { type = "p" }
1313

1414
f :: forall r. { type :: String | r } -> String
15-
f { type = "p" } = "Done"
15+
f { type: "p" } = "Done"
1616
f _ = "Fail"
1717

1818
main :: Eff _ _

src/Language/PureScript/Parser/Declarations.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,12 @@ parseNullBinder = underscore *> return NullBinder
504504

505505
parseIdentifierAndBinder :: TokenParser (String, Binder)
506506
parseIdentifierAndBinder =
507-
do name <- lname
508-
b <- P.option (VarBinder (Ident name)) rest
509-
return (name, b)
510-
<|> (,) <$> stringLiteral <*> rest
507+
do name <- lname
508+
b <- P.option (VarBinder (Ident name)) rest
509+
return (name, b)
510+
<|> (,) <$> stringLiteral <*> rest
511511
where
512-
rest = C.indented *> (equals <|> colon) *> C.indented *> parseBinder
512+
rest = C.indented *> colon *> C.indented *> parseBinder
513513

514514
-- |
515515
-- Parse a binder
@@ -572,4 +572,3 @@ parseBinderNoParens = P.choice
572572
--
573573
parseGuard :: TokenParser Guard
574574
parseGuard = pipe *> C.indented *> parseValue
575-

0 commit comments

Comments
 (0)