git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #2149, remove support for = in ObjectBinder (#2152)

* Fix #2149, remove support for = in ObjectBinder * Extended matches must specify a binder

commite7ddf82d4ef3f99f1933d77a33fc76f09d5d67af authorPhil Freeman <paf31@cantab.net> dateSun 22 May 2016, 15:52 (10 years ago) parentddd8101
8 files changed+15−16
examples/passing/LiberalTypeSynonyms.purs+1−1 examples/passing/NamedPatterns.purs+1−1 examples/passing/ObjectUpdate.purs+2−2 examples/passing/Objects.purs+1−1 examples/passing/Patterns.purs+3−3 examples/passing/Rank2Object.purs+1−1 examples/passing/ReservedWords.purs+1−1 src/Language/PureScript/Parser/Declarations.hs+5−6
examples/passing/LiberalTypeSynonyms.purs+1−1
@@ -17,6 +17,6 @@ type F r = { | r } -> { | r }
1717
1818f :: (forall r. F r) -> String
1919f g = case g { x: "Hello" } of
20− { x = x } -> x
20+ { x: x } -> x
2121
2222main = log "Done"
examples/passing/NamedPatterns.purs+1−1
@@ -4,7 +4,7 @@ import Prelude
44import Control.Monad.Eff.Console (log)
55
66foo = \x -> case x of
7− y@{ foo = "Foo" } -> y
7+ y@{ foo: "Foo" } -> y
88 y -> y
99
1010main = log "Done"
examples/passing/ObjectUpdate.purs+2−2
@@ -9,8 +9,8 @@ update2 :: forall r. { foo :: String | r } -> { foo :: String | r }
99update2 = \o -> o { foo = "Foo" }
1010
1111replace = \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
1616polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }
examples/passing/Objects.purs+1−1
@@ -26,7 +26,7 @@ test4 = test2 weirdObj
2626 weirdObj = { "!@#": 1.0 }
2727
2828test5 = case { "***": 1.0 } of
29− { "***" = n } -> n
29+ { "***": n } -> n
3030
3131test6 = case { "***": 1.0 } of
3232 { "***": n } -> n
examples/passing/Patterns.purs+3−3
@@ -4,12 +4,12 @@ import Prelude
44import Control.Monad.Eff.Console (log)
55
66test = \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
1111f = \o -> case o of
12− { foo = "Foo" } -> o.bar
12+ { foo: "Foo" } -> o.bar
1313 _ -> 0
1414
1515h = \o -> case o of
examples/passing/Rank2Object.purs+1−1
@@ -6,6 +6,6 @@ import Control.Monad.Eff.Console
66data Foo = Foo { id :: forall a. a -> a }
77
88foo :: Foo -> Number
9−foo (Foo { id = f }) = f 0.0
9+foo (Foo { id: f }) = f 0.0
1010
1111main = log "Done"
examples/passing/ReservedWords.purs+1−1
@@ -12,7 +12,7 @@ p :: { type :: String }
1212p = o { type = "p" }
1313
1414f :: forall r. { type :: String | r } -> String
15−f { type = "p" } = "Done"
15+f { type: "p" } = "Done"
1616f _ = "Fail"
1717
1818main :: Eff _ _
src/Language/PureScript/Parser/Declarations.hs+5−6
@@ -504,12 +504,12 @@ parseNullBinder = underscore *> return NullBinder
504504
505505parseIdentifierAndBinder :: TokenParser (String, Binder)
506506parseIdentifierAndBinder =
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--
573573parseGuard :: TokenParser Guard
574574parseGuard = pipe *> C.indented *> parseValue
575−