From b2a8973faf3cd77ffe75fd6302d7919394346e19 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 10 Oct 2017 11:41:29 -0700 Subject: [PATCH 001/176] Update Increment/Decrement constructors; Go assignment --- src/Data/Syntax/Expression.hs | 14 -------------- src/Data/Syntax/Statement.hs | 14 ++++++++++++++ src/Language/Go/Syntax.hs | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Data/Syntax/Expression.hs b/src/Data/Syntax/Expression.hs index 203972e20..a4e878a3d 100644 --- a/src/Data/Syntax/Expression.hs +++ b/src/Data/Syntax/Expression.hs @@ -179,17 +179,3 @@ data Cast a = Cast { castSubject :: !a, castType :: !a } instance Eq1 Cast where liftEq = genericLiftEq instance Ord1 Cast where liftCompare = genericLiftCompare instance Show1 Cast where liftShowsPrec = genericLiftShowsPrec - --- | Increment (e.g. 1++ in C or Go). -newtype Increment a = Increment a - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) - -instance Eq1 Increment where liftEq = genericLiftEq -instance Show1 Increment where liftShowsPrec = genericLiftShowsPrec - --- | Decrement (e.g. 1-- in C or Go). -newtype Decrement a = Decrement a - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) - -instance Eq1 Decrement where liftEq = genericLiftEq -instance Show1 Decrement where liftShowsPrec = genericLiftShowsPrec diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs index 61b01a41d..714e04935 100644 --- a/src/Data/Syntax/Statement.hs +++ b/src/Data/Syntax/Statement.hs @@ -171,3 +171,17 @@ newtype ScopeExit a = ScopeExit [a] instance Eq1 ScopeExit where liftEq = genericLiftEq instance Show1 ScopeExit where liftShowsPrec = genericLiftShowsPrec + +-- | Post increment operator (e.g. 1++ in Go, or i++ in C). +newtype PostIncrement a = PostIncrement a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) + +instance Eq1 PostIncrement where liftEq = genericLiftEq +instance Show1 PostIncrement where liftShowsPrec = genericLiftShowsPrec + +-- | Post decrement operator (e.g. 1-- in Go, or i-- in C). +newtype PostDecrement a = PostDecrement a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) + +instance Eq1 PostDecrement where liftEq = genericLiftEq +instance Show1 PostDecrement where liftShowsPrec = genericLiftShowsPrec diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 73950580b..3de2526e1 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -37,8 +37,8 @@ type Syntax = , Expression.Boolean , Expression.Call , Expression.Comparison - , Expression.Decrement - , Expression.Increment + , Statement.PostDecrement + , Statement.PostIncrement , Expression.MemberAccess , Literal.Array , Literal.Channel @@ -385,7 +385,7 @@ breakStatement :: Assignment breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> labelName) decStatement :: Assignment -decStatement = makeTerm <$> symbol DecStatement <*> children (Expression.Decrement <$> expression) +decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression) gotoStatement :: Assignment gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression) @@ -393,7 +393,7 @@ gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto < ifStatement :: Assignment ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> expression <*> expression <*> (expression <|> emptyTerm)) incStatement :: Assignment -incStatement = makeTerm <$> symbol IncStatement <*> children (Expression.Increment <$> expression) +incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression) labelName :: Assignment labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source) From 7dd673ada9d865c95787478ecf7c07fb8354c364 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 10 Oct 2017 13:28:56 -0700 Subject: [PATCH 002/176] :fire: Declaration.Interface constructor --- src/Data/Syntax/Declaration.hs | 6 ------ src/Language/Go/Syntax.hs | 1 - 2 files changed, 7 deletions(-) diff --git a/src/Data/Syntax/Declaration.hs b/src/Data/Syntax/Declaration.hs index f3d2876d5..84e9c2d7e 100644 --- a/src/Data/Syntax/Declaration.hs +++ b/src/Data/Syntax/Declaration.hs @@ -96,12 +96,6 @@ instance Eq1 Module where liftEq = genericLiftEq instance Ord1 Module where liftCompare = genericLiftCompare instance Show1 Module where liftShowsPrec = genericLiftShowsPrec -data Interface a = Interface { interfaceIdentifier :: !a, interfaceBody :: ![a] } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) - -instance Eq1 Interface where liftEq = genericLiftEq -instance Show1 Interface where liftShowsPrec = genericLiftShowsPrec - -- | A decorator in Python data Decorator a = Decorator { decoratorIdentifier :: !a, decoratorParamaters :: ![a], decoratorBody :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 3de2526e1..4aa017380 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -29,7 +29,6 @@ type Syntax = , Declaration.Constructor , Declaration.Function , Declaration.Import - , Declaration.Interface , Declaration.Method , Declaration.Module , Expression.Arithmetic From beebeb999168a00deaae70413106a85f244c657b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 10 Oct 2017 13:37:47 -0700 Subject: [PATCH 003/176] Upate Go related constructors to have Ord and Ord1 instances --- src/Data/Syntax/Literal.hs | 6 ++++-- src/Data/Syntax/Statement.hs | 9 ++++++--- src/Data/Syntax/Type.hs | 27 ++++++++++++++++++--------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/Data/Syntax/Literal.hs b/src/Data/Syntax/Literal.hs index 104468a2d..be75754be 100644 --- a/src/Data/Syntax/Literal.hs +++ b/src/Data/Syntax/Literal.hs @@ -163,16 +163,18 @@ instance Show1 Set where liftShowsPrec = genericLiftShowsPrec -- A channel literal in Go newtype Channel a = Channel { channelContent :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Channel where liftEq = genericLiftEq +instance Ord1 Channel where liftCompare = genericLiftCompare instance Show1 Channel where liftShowsPrec = genericLiftShowsPrec -- A composite literal in Go data Composite a = Composite { compositeType :: !a, compositeElement :: !a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Composite where liftEq = genericLiftEq +instance Ord1 Composite where liftCompare = genericLiftCompare instance Show1 Composite where liftShowsPrec = genericLiftShowsPrec -- TODO: Object literals as distinct from hash literals? Or coalesce object/hash literals into “key-value literals”? diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs index c9d40074a..1afe3b599 100644 --- a/src/Data/Syntax/Statement.hs +++ b/src/Data/Syntax/Statement.hs @@ -26,9 +26,10 @@ instance Ord1 Else where liftCompare = genericLiftCompare instance Show1 Else where liftShowsPrec = genericLiftShowsPrec newtype Goto a = Goto { gotoLocation :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Goto where liftEq = genericLiftEq +instance Ord1 Goto where liftCompare = genericLiftCompare instance Show1 Goto where liftShowsPrec = genericLiftShowsPrec -- TODO: Alternative definition would flatten if/else if/else chains: data If a = If ![(a, a)] !(Maybe a) @@ -197,14 +198,16 @@ instance Show1 ScopeExit where liftShowsPrec = genericLiftShowsPrec -- | Post increment operator (e.g. 1++ in Go, or i++ in C). newtype PostIncrement a = PostIncrement a - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 PostIncrement where liftEq = genericLiftEq +instance Ord1 PostIncrement where liftCompare = genericLiftCompare instance Show1 PostIncrement where liftShowsPrec = genericLiftShowsPrec -- | Post decrement operator (e.g. 1-- in Go, or i-- in C). newtype PostDecrement a = PostDecrement a - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 PostDecrement where liftEq = genericLiftEq +instance Ord1 PostDecrement where liftCompare = genericLiftCompare instance Show1 PostDecrement where liftShowsPrec = genericLiftShowsPrec diff --git a/src/Data/Syntax/Type.hs b/src/Data/Syntax/Type.hs index 08f251429..ba6a51186 100644 --- a/src/Data/Syntax/Type.hs +++ b/src/Data/Syntax/Type.hs @@ -17,9 +17,10 @@ instance Ord1 Annotation where liftCompare = genericLiftCompare instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec data Function a = Function { functionParameters :: [a], functionReturn :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Function where liftEq = genericLiftEq +instance Ord1 Function where liftCompare = genericLiftCompare instance Show1 Function where liftShowsPrec = genericLiftShowsPrec newtype Product a = Product { productElements :: [a] } @@ -30,51 +31,59 @@ instance Ord1 Product where liftCompare = genericLiftCompare instance Show1 Product where liftShowsPrec = genericLiftShowsPrec data Array a = Array { arraySize :: Maybe a, arrayElementType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Array where liftEq = genericLiftEq +instance Ord1 Array where liftCompare = genericLiftCompare instance Show1 Array where liftShowsPrec = genericLiftShowsPrec newtype BiDirectionalChannel a = BiDirectionalChannel { biDirectionalChannelElementType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 BiDirectionalChannel where liftEq = genericLiftEq +instance Ord1 BiDirectionalChannel where liftCompare = genericLiftCompare instance Show1 BiDirectionalChannel where liftShowsPrec = genericLiftShowsPrec newtype Interface a = Interface { interfaceElements :: [a] } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Interface where liftEq = genericLiftEq +instance Ord1 Interface where liftCompare = genericLiftCompare instance Show1 Interface where liftShowsPrec = genericLiftShowsPrec data Map a = Map { mapKeyType :: a, mapElementType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Map where liftEq = genericLiftEq +instance Ord1 Map where liftCompare = genericLiftCompare instance Show1 Map where liftShowsPrec = genericLiftShowsPrec newtype Pointer a = Pointer { pointerType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Pointer where liftEq = genericLiftEq +instance Ord1 Pointer where liftCompare = genericLiftCompare instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec newtype ReceiveChannel a = ReceiveChannel { receiveChannelElementType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 ReceiveChannel where liftEq = genericLiftEq +instance Ord1 ReceiveChannel where liftCompare = genericLiftCompare instance Show1 ReceiveChannel where liftShowsPrec = genericLiftShowsPrec newtype SendChannel a = SendChannel { sendChannelElementType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 SendChannel where liftEq = genericLiftEq +instance Ord1 SendChannel where liftCompare = genericLiftCompare instance Show1 SendChannel where liftShowsPrec = genericLiftShowsPrec newtype Slice a = Slice { sliceElementType :: a } - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Slice where liftEq = genericLiftEq +instance Ord1 Slice where liftCompare = genericLiftCompare instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec data TypeParameters a = TypeParameters { typeParameters :: ![a] } From d4e1352b0656b5843831856ac8b856b2b50c5857 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 10 Oct 2017 13:56:48 -0700 Subject: [PATCH 004/176] Fix warning --- src/Language/Go/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 4aa017380..581bd835d 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -9,7 +9,7 @@ module Language.Go.Syntax import Data.Functor (void) import Data.List.NonEmpty (some1) import Data.Record -import Data.Syntax (contextualize, postContextualize, emptyTerm, parseError, handleError, infixContext, makeTerm, makeTerm', makeTerm1) +import Data.Syntax (contextualize, emptyTerm, parseError, handleError, infixContext, makeTerm, makeTerm', makeTerm1) import qualified Data.Syntax as Syntax import Data.Syntax.Assignment hiding (Assignment, Error) import qualified Data.Syntax.Assignment as Assignment From 88a049a1429fa487b9b5ea96a4f7d6dc16b72457 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 10 Oct 2017 14:31:52 -0700 Subject: [PATCH 005/176] Regenerate tests (based on tree-sitter-go grammar updates) --- test/fixtures/go/array-types.diffA-B.txt | 1 + test/fixtures/go/array-types.diffB-A.txt | 1 + test/fixtures/go/array-types.parseA.txt | 1 + test/fixtures/go/array-types.parseB.txt | 1 + test/fixtures/go/constructors.diffA-B.txt | 1 + test/fixtures/go/constructors.diffB-A.txt | 1 + test/fixtures/go/constructors.parseA.txt | 1 + test/fixtures/go/constructors.parseB.txt | 1 + test/fixtures/go/for-statements.diffA-B.txt | 3 +++ test/fixtures/go/for-statements.diffB-A.txt | 3 +++ test/fixtures/go/for-statements.parseA.txt | 2 ++ test/fixtures/go/for-statements.parseB.txt | 1 + test/fixtures/go/if-statements.diffA-B.txt | 22 ++++++++++--------- test/fixtures/go/if-statements.diffB-A.txt | 22 ++++++++++--------- test/fixtures/go/if-statements.parseA.txt | 20 +++++++++-------- test/fixtures/go/if-statements.parseB.txt | 20 +++++++++-------- .../fixtures/go/switch-statements.diffA-B.txt | 5 +++++ .../fixtures/go/switch-statements.diffB-A.txt | 5 +++++ test/fixtures/go/switch-statements.parseA.txt | 3 +++ test/fixtures/go/switch-statements.parseB.txt | 3 +++ 20 files changed, 79 insertions(+), 38 deletions(-) diff --git a/test/fixtures/go/array-types.diffA-B.txt b/test/fixtures/go/array-types.diffA-B.txt index 6b19cfbc2..524b43e46 100644 --- a/test/fixtures/go/array-types.diffA-B.txt +++ b/test/fixtures/go/array-types.diffA-B.txt @@ -11,6 +11,7 @@ (RelationalOperator { (NumberLiteral) ->(NumberLiteral) } + (Other "+") { (NumberLiteral) ->(NumberLiteral) }) { (Identifier) diff --git a/test/fixtures/go/array-types.diffB-A.txt b/test/fixtures/go/array-types.diffB-A.txt index 6b19cfbc2..524b43e46 100644 --- a/test/fixtures/go/array-types.diffB-A.txt +++ b/test/fixtures/go/array-types.diffB-A.txt @@ -11,6 +11,7 @@ (RelationalOperator { (NumberLiteral) ->(NumberLiteral) } + (Other "+") { (NumberLiteral) ->(NumberLiteral) }) { (Identifier) diff --git a/test/fixtures/go/array-types.parseA.txt b/test/fixtures/go/array-types.parseA.txt index d78b2c85a..8bb054b7b 100644 --- a/test/fixtures/go/array-types.parseA.txt +++ b/test/fixtures/go/array-types.parseA.txt @@ -10,5 +10,6 @@ (ArrayTy (RelationalOperator (NumberLiteral) + (Other "+") (NumberLiteral)) (Identifier)))))) diff --git a/test/fixtures/go/array-types.parseB.txt b/test/fixtures/go/array-types.parseB.txt index d78b2c85a..8bb054b7b 100644 --- a/test/fixtures/go/array-types.parseB.txt +++ b/test/fixtures/go/array-types.parseB.txt @@ -10,5 +10,6 @@ (ArrayTy (RelationalOperator (NumberLiteral) + (Other "+") (NumberLiteral)) (Identifier)))))) diff --git a/test/fixtures/go/constructors.diffA-B.txt b/test/fixtures/go/constructors.diffA-B.txt index a805732f2..8f4721301 100644 --- a/test/fixtures/go/constructors.diffA-B.txt +++ b/test/fixtures/go/constructors.diffA-B.txt @@ -16,6 +16,7 @@ ->(Identifier) }) (RelationalOperator (Identifier) + (Other "-") (Identifier))) (FunctionCall (Identifier) diff --git a/test/fixtures/go/constructors.diffB-A.txt b/test/fixtures/go/constructors.diffB-A.txt index a805732f2..8f4721301 100644 --- a/test/fixtures/go/constructors.diffB-A.txt +++ b/test/fixtures/go/constructors.diffB-A.txt @@ -16,6 +16,7 @@ ->(Identifier) }) (RelationalOperator (Identifier) + (Other "-") (Identifier))) (FunctionCall (Identifier) diff --git a/test/fixtures/go/constructors.parseA.txt b/test/fixtures/go/constructors.parseA.txt index 7d7c8d716..df72dd0e0 100644 --- a/test/fixtures/go/constructors.parseA.txt +++ b/test/fixtures/go/constructors.parseA.txt @@ -14,6 +14,7 @@ (Identifier)) (RelationalOperator (Identifier) + (Other "-") (Identifier))) (FunctionCall (Identifier) diff --git a/test/fixtures/go/constructors.parseB.txt b/test/fixtures/go/constructors.parseB.txt index 7d7c8d716..df72dd0e0 100644 --- a/test/fixtures/go/constructors.parseB.txt +++ b/test/fixtures/go/constructors.parseB.txt @@ -14,6 +14,7 @@ (Identifier)) (RelationalOperator (Identifier) + (Other "-") (Identifier))) (FunctionCall (Identifier) diff --git a/test/fixtures/go/for-statements.diffA-B.txt b/test/fixtures/go/for-statements.diffA-B.txt index 0f830ba07..f5ef5ab4f 100644 --- a/test/fixtures/go/for-statements.diffA-B.txt +++ b/test/fixtures/go/for-statements.diffA-B.txt @@ -31,6 +31,7 @@ {+(For {+(RelationalOperator {+(Identifier)+} + {+(Other "<")+} {+(NumberLiteral)+})+} {+(IncrementStatement)+} {+(FunctionCall @@ -50,6 +51,7 @@ {-(NumberLiteral)-})-})-} {-(RelationalOperator {-(Identifier)-} + {-(Other "<")-} {-(NumberLiteral)-})-} {-(IncrementStatement)-} {-(FunctionCall @@ -59,6 +61,7 @@ {-(For {-(RelationalOperator {-(Identifier)-} + {-(Other "<")-} {-(NumberLiteral)-})-} {-(IncrementStatement)-} {-(FunctionCall diff --git a/test/fixtures/go/for-statements.diffB-A.txt b/test/fixtures/go/for-statements.diffB-A.txt index 07ccd55ed..fd616ba39 100644 --- a/test/fixtures/go/for-statements.diffB-A.txt +++ b/test/fixtures/go/for-statements.diffB-A.txt @@ -23,6 +23,7 @@ {+(NumberLiteral)+})+})+} {+(RelationalOperator {+(Identifier)+} + {+(Other "<")+} {+(NumberLiteral)+})+} {+(IncrementStatement)+} {+(FunctionCall @@ -32,6 +33,7 @@ {+(For {+(RelationalOperator {+(Identifier)+} + {+(Other "<")+} {+(NumberLiteral)+})+} {+(IncrementStatement)+} {+(FunctionCall @@ -59,6 +61,7 @@ {-(For {-(RelationalOperator {-(Identifier)-} + {-(Other "<")-} {-(NumberLiteral)-})-} {-(IncrementStatement)-} {-(FunctionCall diff --git a/test/fixtures/go/for-statements.parseA.txt b/test/fixtures/go/for-statements.parseA.txt index 3966146b1..b63116cb6 100644 --- a/test/fixtures/go/for-statements.parseA.txt +++ b/test/fixtures/go/for-statements.parseA.txt @@ -18,6 +18,7 @@ (NumberLiteral))) (RelationalOperator (Identifier) + (Other "<") (NumberLiteral)) (IncrementStatement) (FunctionCall @@ -27,6 +28,7 @@ (For (RelationalOperator (Identifier) + (Other "<") (NumberLiteral)) (IncrementStatement) (FunctionCall diff --git a/test/fixtures/go/for-statements.parseB.txt b/test/fixtures/go/for-statements.parseB.txt index 537d98a58..f665ed2c8 100644 --- a/test/fixtures/go/for-statements.parseB.txt +++ b/test/fixtures/go/for-statements.parseB.txt @@ -25,6 +25,7 @@ (For (RelationalOperator (Identifier) + (Other "<") (NumberLiteral)) (IncrementStatement) (FunctionCall diff --git a/test/fixtures/go/if-statements.diffA-B.txt b/test/fixtures/go/if-statements.diffA-B.txt index 71ebaacda..2c8158f1d 100644 --- a/test/fixtures/go/if-statements.diffA-B.txt +++ b/test/fixtures/go/if-statements.diffA-B.txt @@ -12,13 +12,14 @@ (FunctionCall (Identifier)))) (If - (VarDecl - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (FunctionCall - (Identifier)))) + (Other "if_initializer" + (VarDecl + (Other "expression_list" + { (Identifier) + ->(Identifier) }) + (Other "expression_list" + (FunctionCall + (Identifier))))) (Identifier) (ExpressionStatements (FunctionCall @@ -30,6 +31,7 @@ (ExpressionStatements (FunctionCall (Identifier))) - (ExpressionStatements - (FunctionCall - (Identifier)))))) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + (Identifier))))))) diff --git a/test/fixtures/go/if-statements.diffB-A.txt b/test/fixtures/go/if-statements.diffB-A.txt index 71ebaacda..2c8158f1d 100644 --- a/test/fixtures/go/if-statements.diffB-A.txt +++ b/test/fixtures/go/if-statements.diffB-A.txt @@ -12,13 +12,14 @@ (FunctionCall (Identifier)))) (If - (VarDecl - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (FunctionCall - (Identifier)))) + (Other "if_initializer" + (VarDecl + (Other "expression_list" + { (Identifier) + ->(Identifier) }) + (Other "expression_list" + (FunctionCall + (Identifier))))) (Identifier) (ExpressionStatements (FunctionCall @@ -30,6 +31,7 @@ (ExpressionStatements (FunctionCall (Identifier))) - (ExpressionStatements - (FunctionCall - (Identifier)))))) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + (Identifier))))))) diff --git a/test/fixtures/go/if-statements.parseA.txt b/test/fixtures/go/if-statements.parseA.txt index 0f93faf63..99c85c436 100644 --- a/test/fixtures/go/if-statements.parseA.txt +++ b/test/fixtures/go/if-statements.parseA.txt @@ -11,12 +11,13 @@ (FunctionCall (Identifier)))) (If - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FunctionCall - (Identifier)))) + (Other "if_initializer" + (VarDecl + (Other "expression_list" + (Identifier)) + (Other "expression_list" + (FunctionCall + (Identifier))))) (Identifier) (ExpressionStatements (FunctionCall @@ -27,6 +28,7 @@ (ExpressionStatements (FunctionCall (Identifier))) - (ExpressionStatements - (FunctionCall - (Identifier)))))) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + (Identifier))))))) diff --git a/test/fixtures/go/if-statements.parseB.txt b/test/fixtures/go/if-statements.parseB.txt index 0f93faf63..99c85c436 100644 --- a/test/fixtures/go/if-statements.parseB.txt +++ b/test/fixtures/go/if-statements.parseB.txt @@ -11,12 +11,13 @@ (FunctionCall (Identifier)))) (If - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FunctionCall - (Identifier)))) + (Other "if_initializer" + (VarDecl + (Other "expression_list" + (Identifier)) + (Other "expression_list" + (FunctionCall + (Identifier))))) (Identifier) (ExpressionStatements (FunctionCall @@ -27,6 +28,7 @@ (ExpressionStatements (FunctionCall (Identifier))) - (ExpressionStatements - (FunctionCall - (Identifier)))))) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + (Identifier))))))) diff --git a/test/fixtures/go/switch-statements.diffA-B.txt b/test/fixtures/go/switch-statements.diffA-B.txt index 4ab132af2..a75bae615 100644 --- a/test/fixtures/go/switch-statements.diffA-B.txt +++ b/test/fixtures/go/switch-statements.diffA-B.txt @@ -11,6 +11,7 @@ (RelationalOperator { (Identifier) ->(Identifier) } + (Other "<") { (Identifier) ->(Identifier) }))) (FunctionCall @@ -20,6 +21,7 @@ {+(Other "expression_list" {+(RelationalOperator {+(Identifier)+} + {+(Other "<")+} {+(Identifier)+})+})+})+} {+(FunctionCall {+(Identifier)+})+})+} @@ -29,6 +31,8 @@ (RelationalOperator { (Identifier) ->(Identifier) } + { (Other "<") + ->(Other "==") } { (Identifier) ->(NumberLiteral) }))) (FunctionCall @@ -39,6 +43,7 @@ {-(Other "expression_list" {-(RelationalOperator {-(Identifier)-} + {-(Other "==")-} {-(NumberLiteral)-})-})-})-} {-(FunctionCall {-(Identifier)-})-})-}))) diff --git a/test/fixtures/go/switch-statements.diffB-A.txt b/test/fixtures/go/switch-statements.diffB-A.txt index 17b75115f..ee63339c5 100644 --- a/test/fixtures/go/switch-statements.diffB-A.txt +++ b/test/fixtures/go/switch-statements.diffB-A.txt @@ -11,6 +11,7 @@ (RelationalOperator { (Identifier) ->(Identifier) } + (Other "<") { (Identifier) ->(Identifier) }))) (FunctionCall @@ -20,6 +21,7 @@ {+(Other "expression_list" {+(RelationalOperator {+(Identifier)+} + {+(Other "<")+} {+(Identifier)+})+})+})+} {+(FunctionCall {+(Identifier)+})+})+} @@ -28,6 +30,7 @@ {+(Other "expression_list" {+(RelationalOperator {+(Identifier)+} + {+(Other "==")+} {+(NumberLiteral)+})+})+})+} {+(FunctionCall {+(Identifier)+})+})+} @@ -36,6 +39,7 @@ {-(Other "expression_list" {-(RelationalOperator {-(Identifier)-} + {-(Other "<")-} {-(Identifier)-})-})-})-} {-(FunctionCall {-(Identifier)-})-})-} @@ -44,6 +48,7 @@ {-(Other "expression_list" {-(RelationalOperator {-(Identifier)-} + {-(Other "==")-} {-(NumberLiteral)-})-})-})-} {-(FunctionCall {-(Identifier)-})-})-}))) diff --git a/test/fixtures/go/switch-statements.parseA.txt b/test/fixtures/go/switch-statements.parseA.txt index 2ad35defe..92237d7c3 100644 --- a/test/fixtures/go/switch-statements.parseA.txt +++ b/test/fixtures/go/switch-statements.parseA.txt @@ -10,6 +10,7 @@ (Other "expression_list" (RelationalOperator (Identifier) + (Other "<") (Identifier)))) (FunctionCall (Identifier))) @@ -18,6 +19,7 @@ (Other "expression_list" (RelationalOperator (Identifier) + (Other "<") (Identifier)))) (FunctionCall (Identifier))) @@ -26,6 +28,7 @@ (Other "expression_list" (RelationalOperator (Identifier) + (Other "==") (NumberLiteral)))) (FunctionCall (Identifier)))))) diff --git a/test/fixtures/go/switch-statements.parseB.txt b/test/fixtures/go/switch-statements.parseB.txt index 2ad35defe..92237d7c3 100644 --- a/test/fixtures/go/switch-statements.parseB.txt +++ b/test/fixtures/go/switch-statements.parseB.txt @@ -10,6 +10,7 @@ (Other "expression_list" (RelationalOperator (Identifier) + (Other "<") (Identifier)))) (FunctionCall (Identifier))) @@ -18,6 +19,7 @@ (Other "expression_list" (RelationalOperator (Identifier) + (Other "<") (Identifier)))) (FunctionCall (Identifier))) @@ -26,6 +28,7 @@ (Other "expression_list" (RelationalOperator (Identifier) + (Other "==") (NumberLiteral)))) (FunctionCall (Identifier)))))) From 0452d906724d00e0774921e581ef5ac6f1cc6e77 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 11 Oct 2017 10:12:32 -0700 Subject: [PATCH 006/176] Update Go.Syntax -> Go.Assignment --- semantic-diff.cabal | 2 +- src/Language/Go/{Syntax.hs => Assignment.hs} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/Language/Go/{Syntax.hs => Assignment.hs} (99%) diff --git a/semantic-diff.cabal b/semantic-diff.cabal index 6b84f6988..af722825b 100644 --- a/semantic-diff.cabal +++ b/semantic-diff.cabal @@ -53,7 +53,7 @@ library , Language.Markdown.Syntax , Language.Go , Language.Go.Grammar - , Language.Go.Syntax + , Language.Go.Assignment , Language.JSON.Grammar , Language.JSON.Assignment , Language.Ruby.Grammar diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Assignment.hs similarity index 99% rename from src/Language/Go/Syntax.hs rename to src/Language/Go/Assignment.hs index 581bd835d..5ffd6330c 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Assignment.hs @@ -1,5 +1,5 @@ {-# LANGUAGE DataKinds, DeriveAnyClass, RankNTypes, TypeOperators #-} -module Language.Go.Syntax +module Language.Go.Assignment ( assignment , Syntax , Grammar From d7be269a01a1bcb859b2b320ee0665bd9b8672f3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 23 Oct 2017 16:41:11 -0700 Subject: [PATCH 007/176] Assign if statements with if initializers --- src/Language/Go/Assignment.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 5ffd6330c..59fc53f26 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -93,12 +93,14 @@ expressionChoices = , constVarSpecification , decStatement , element + , elseClause , expressionList , fieldDeclaration , fieldIdentifier , functionDeclaration , functionType , gotoStatement + , ifInitializer , ifStatement , incStatement , identifier @@ -390,7 +392,14 @@ gotoStatement :: Assignment gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression) ifStatement :: Assignment -ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> expression <*> expression <*> (expression <|> emptyTerm)) +ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> (makeTerm <$> location <*> manyTermsTill expression (void (symbol Block))) <*> expression <*> (expression <|> emptyTerm)) + +ifInitializer :: Assignment +ifInitializer = symbol IfInitializer *> children expression + +elseClause :: Assignment +elseClause = symbol ElseClause *> children expression + incStatement :: Assignment incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression) From 1de4ab6bc01b3205b400ab7afbdae83c17133504 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 23 Oct 2017 16:52:36 -0700 Subject: [PATCH 008/176] Update if-statements tests --- test/fixtures/go/if-statements.A.go | 7 +++++++ test/fixtures/go/if-statements.B.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/test/fixtures/go/if-statements.A.go b/test/fixtures/go/if-statements.A.go index 76a6f335f..0e8854b48 100644 --- a/test/fixtures/go/if-statements.A.go +++ b/test/fixtures/go/if-statements.A.go @@ -13,3 +13,10 @@ b() c() } } +if num := 9; num < 0 { +d() +} else if num < 10 { +e() +} else { +f() +} diff --git a/test/fixtures/go/if-statements.B.go b/test/fixtures/go/if-statements.B.go index 39dfc0da4..f9f99092e 100644 --- a/test/fixtures/go/if-statements.B.go +++ b/test/fixtures/go/if-statements.B.go @@ -13,3 +13,10 @@ b() c() } } +if num := 10; num < 0 { +f() +} else if num < 100 { +g() +} else { +h() +} From 835eba454c398fdb8dae2ed34ba4dd8e10b13d6a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 11:52:25 -0700 Subject: [PATCH 009/176] Add Pointer and Reference constructors to Statement --- src/Data/Syntax/Statement.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs index 1afe3b599..69c48a4e5 100644 --- a/src/Data/Syntax/Statement.hs +++ b/src/Data/Syntax/Statement.hs @@ -59,6 +59,25 @@ instance Ord1 Let where liftCompare = genericLiftCompare instance Show1 Let where liftShowsPrec = genericLiftShowsPrec +-- Pointers + +-- | A declared pointer (e.g. var pointer *int in Go) +newtype Pointer a = Pointer a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Pointer where liftEq = genericLiftEq +instance Ord1 Pointer where liftCompare = genericLiftCompare +instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec + +-- | A reference to a pointer's address (e.g. &pointer in Go) +newtype Reference a = Reference a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Reference where liftEq = genericLiftEq +instance Ord1 Reference where liftCompare = genericLiftCompare +instance Show1 Reference where liftShowsPrec = genericLiftShowsPrec + + -- Assignment -- | Assignment to a variable or other lvalue. From 10f728d2787c0eb2ca936cdd48bb053e4485bc4f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 11:53:21 -0700 Subject: [PATCH 010/176] Rename --- src/Language/Go/Assignment.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 59fc53f26..07111cf31 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -89,8 +89,8 @@ expressionChoices = , channelType , comment , compositeLiteral - , constVarDeclaration - , constVarSpecification + , varDeclaration + , varSpecification , decStatement , element , elseClause @@ -306,14 +306,14 @@ block = symbol Block *> children expressions callExpression :: Assignment callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> identifier <*> pure [] <*> emptyTerm) -constVarDeclaration :: Assignment -constVarDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions +varDeclaration :: Assignment +varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions -constVarSpecification :: Assignment -constVarSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment - <$> pure [] - <*> (annotatedLHS <|> identifiers) - <*> expressions) +varSpecification :: Assignment +varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment + <$> pure [] + <*> (annotatedLHS <|> identifiers) + <*> expressions) where annotatedLHS = makeTerm <$> location <*> (Type.Annotation <$> (makeTerm <$> location <*> (manyTermsTill identifier (void (symbol TypeIdentifier)))) From 4fe2ad2609af3a240e782d8f03124a8a06f35345 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 11:53:35 -0700 Subject: [PATCH 011/176] Assign pointer references --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 07111cf31..34141c4ad 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -271,10 +271,11 @@ parenthesizedExpression :: Assignment parenthesizedExpression = symbol ParenthesizedExpression *> children expressions unaryExpression :: Assignment -unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus +unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) unaryPlus = children (symbol AnonPlus *> expression) + unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Statement.Reference <$> expression)) binaryExpression :: Assignment binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression From bddb35ce2864a1388691bfb311f76262db5855e8 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 14:16:15 -0700 Subject: [PATCH 012/176] Assign keyed elements --- src/Language/Go/Assignment.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 34141c4ad..4fcd63666 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -110,6 +110,7 @@ expressionChoices = , interfaceType , interpretedStringLiteral , intLiteral + , keyedElement , labelName , literalValue , mapType @@ -404,6 +405,9 @@ elseClause = symbol ElseClause *> children expression incStatement :: Assignment incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression) +keyedElement :: Assignment +keyedElement = makeTerm <$> symbol KeyedElement <*> children (Literal.KeyValue <$> expression <*> expression) + labelName :: Assignment labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source) From 5e74311b71d7c6a1f6f25341a2cc23faf407b650 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 14:16:35 -0700 Subject: [PATCH 013/176] Add pointer and reference --- src/Language/Go/Assignment.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 4fcd63666..2b0111ceb 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -50,6 +50,8 @@ type Syntax = , Statement.Break , Statement.Goto , Statement.If + , Statement.Pointer + , Statement.Reference , Statement.Return , Syntax.Context , Syntax.Error From 5222b02c49d7ad91a5744869dbe691e8839dd75b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 14:19:49 -0700 Subject: [PATCH 014/176] Add pointer / reference var assignment --- test/fixtures/go/assignment-statements.A.go | 1 + test/fixtures/go/assignment-statements.B.go | 1 + 2 files changed, 2 insertions(+) diff --git a/test/fixtures/go/assignment-statements.A.go b/test/fixtures/go/assignment-statements.A.go index 072782b16..9633bfa9e 100644 --- a/test/fixtures/go/assignment-statements.A.go +++ b/test/fixtures/go/assignment-statements.A.go @@ -5,4 +5,5 @@ a = 1 b, c += 2, 3 d *= 3 e += 1 +var pointer *Point3D = &Point3D{y: 1000} } diff --git a/test/fixtures/go/assignment-statements.B.go b/test/fixtures/go/assignment-statements.B.go index 2e6b444ce..3945d0dce 100644 --- a/test/fixtures/go/assignment-statements.B.go +++ b/test/fixtures/go/assignment-statements.B.go @@ -5,4 +5,5 @@ x = 1 y, c += 2, 3 z *= 3 h += 1 +var pointer *Point2D = &Point2D{x: 1000} } From 6510458e1642bac9fee9d1c89c5ea77149777aca Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 15:43:14 -0700 Subject: [PATCH 015/176] Update assignment-statements parse test results --- test/fixtures/go/assignment-statements.parseA.txt | 14 +++++++++++++- test/fixtures/go/assignment-statements.parseB.txt | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/test/fixtures/go/assignment-statements.parseA.txt b/test/fixtures/go/assignment-statements.parseA.txt index d68bf8071..22a46eeff 100644 --- a/test/fixtures/go/assignment-statements.parseA.txt +++ b/test/fixtures/go/assignment-statements.parseA.txt @@ -25,4 +25,16 @@ (Other "expression_list" (Identifier)) (Other "expression_list" - (NumberLiteral))))) + (NumberLiteral))) + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + (Identifier)) + (Other "expression_list" + (Operator + (Other "composite_literal" + (Identifier) + (Pair + (Identifier) + (NumberLiteral))))))))) diff --git a/test/fixtures/go/assignment-statements.parseB.txt b/test/fixtures/go/assignment-statements.parseB.txt index d68bf8071..22a46eeff 100644 --- a/test/fixtures/go/assignment-statements.parseB.txt +++ b/test/fixtures/go/assignment-statements.parseB.txt @@ -25,4 +25,16 @@ (Other "expression_list" (Identifier)) (Other "expression_list" - (NumberLiteral))))) + (NumberLiteral))) + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + (Identifier)) + (Other "expression_list" + (Operator + (Other "composite_literal" + (Identifier) + (Pair + (Identifier) + (NumberLiteral))))))))) From 2bd9fe9e8c062c3dea1875b9df154343da799e00 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 15:49:07 -0700 Subject: [PATCH 016/176] Fix assignment statement diff tests --- .../go/assignment-statements.diffA-B.txt | 17 ++++++++++++++++- .../go/assignment-statements.diffB-A.txt | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/test/fixtures/go/assignment-statements.diffA-B.txt b/test/fixtures/go/assignment-statements.diffA-B.txt index 59ab2cf77..9937abe08 100644 --- a/test/fixtures/go/assignment-statements.diffA-B.txt +++ b/test/fixtures/go/assignment-statements.diffA-B.txt @@ -29,4 +29,19 @@ { (Identifier) ->(Identifier) }) (Other "expression_list" - (NumberLiteral))))) + (NumberLiteral))) + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + { (Identifier) + ->(Identifier) }) + (Other "expression_list" + (Operator + (Other "composite_literal" + { (Identifier) + ->(Identifier) } + (Pair + { (Identifier) + ->(Identifier) } + (NumberLiteral))))))))) diff --git a/test/fixtures/go/assignment-statements.diffB-A.txt b/test/fixtures/go/assignment-statements.diffB-A.txt index 59ab2cf77..daa51f6cf 100644 --- a/test/fixtures/go/assignment-statements.diffB-A.txt +++ b/test/fixtures/go/assignment-statements.diffB-A.txt @@ -29,4 +29,19 @@ { (Identifier) ->(Identifier) }) (Other "expression_list" - (NumberLiteral))))) + (NumberLiteral))) + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + { (Identifier) + ->(Identifier) }) + (Other "expression_list" + (Operator + (Other "composite_literal" + { (Identifier) + ->(Identifier) } + (Pair + { (Identifier) + ->(Identifier) } + (NumberLiteral))))))))) From 96213206a01b3ac736bf4d48f0516494aeaf7115 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 16:00:37 -0700 Subject: [PATCH 017/176] Update tests --- .../go/assignment-statements.diffA-B.txt | 22 ++++++------ .../go/assignment-statements.diffB-A.txt | 24 ++++++------- .../go/assignment-statements.parseA.txt | 22 ++++++------ .../go/assignment-statements.parseB.txt | 22 ++++++------ test/fixtures/go/if-statements.A.go | 2 +- test/fixtures/go/if-statements.B.go | 2 +- test/fixtures/go/if-statements.diffA-B.txt | 34 ++++++++++++++++++- test/fixtures/go/if-statements.diffB-A.txt | 34 ++++++++++++++++++- test/fixtures/go/if-statements.parseA.txt | 29 +++++++++++++++- test/fixtures/go/if-statements.parseB.txt | 29 +++++++++++++++- 10 files changed, 169 insertions(+), 51 deletions(-) diff --git a/test/fixtures/go/assignment-statements.diffA-B.txt b/test/fixtures/go/assignment-statements.diffA-B.txt index 9937abe08..3f4f26dce 100644 --- a/test/fixtures/go/assignment-statements.diffA-B.txt +++ b/test/fixtures/go/assignment-statements.diffA-B.txt @@ -30,18 +30,18 @@ ->(Identifier) }) (Other "expression_list" (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy - { (Identifier) - ->(Identifier) }) - (Other "expression_list" + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + { (Identifier) + ->(Identifier) }) + (Other "expression_list" (Operator (Other "composite_literal" { (Identifier) ->(Identifier) } - (Pair - { (Identifier) - ->(Identifier) } - (NumberLiteral))))))))) + (Pair + { (Identifier) + ->(Identifier) } + (NumberLiteral))))))))) diff --git a/test/fixtures/go/assignment-statements.diffB-A.txt b/test/fixtures/go/assignment-statements.diffB-A.txt index daa51f6cf..3f4f26dce 100644 --- a/test/fixtures/go/assignment-statements.diffB-A.txt +++ b/test/fixtures/go/assignment-statements.diffB-A.txt @@ -30,18 +30,18 @@ ->(Identifier) }) (Other "expression_list" (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (Operator - (Other "composite_literal" - { (Identifier) - ->(Identifier) } + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + { (Identifier) + ->(Identifier) }) + (Other "expression_list" + (Operator + (Other "composite_literal" + { (Identifier) + ->(Identifier) } (Pair { (Identifier) ->(Identifier) } - (NumberLiteral))))))))) + (NumberLiteral))))))))) diff --git a/test/fixtures/go/assignment-statements.parseA.txt b/test/fixtures/go/assignment-statements.parseA.txt index 22a46eeff..5d74921f0 100644 --- a/test/fixtures/go/assignment-statements.parseA.txt +++ b/test/fixtures/go/assignment-statements.parseA.txt @@ -26,15 +26,15 @@ (Identifier)) (Other "expression_list" (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy - (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + (Identifier)) + (Other "expression_list" + (Operator + (Other "composite_literal" + (Identifier) + (Pair (Identifier) - (Pair - (Identifier) - (NumberLiteral))))))))) + (NumberLiteral))))))))) diff --git a/test/fixtures/go/assignment-statements.parseB.txt b/test/fixtures/go/assignment-statements.parseB.txt index 22a46eeff..5d74921f0 100644 --- a/test/fixtures/go/assignment-statements.parseB.txt +++ b/test/fixtures/go/assignment-statements.parseB.txt @@ -26,15 +26,15 @@ (Identifier)) (Other "expression_list" (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy - (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" + (Other "var_declaration" + (VarAssignment + (Identifier) + (PointerTy + (Identifier)) + (Other "expression_list" + (Operator + (Other "composite_literal" + (Identifier) + (Pair (Identifier) - (Pair - (Identifier) - (NumberLiteral))))))))) + (NumberLiteral))))))))) diff --git a/test/fixtures/go/if-statements.A.go b/test/fixtures/go/if-statements.A.go index 0e8854b48..0c6d39359 100644 --- a/test/fixtures/go/if-statements.A.go +++ b/test/fixtures/go/if-statements.A.go @@ -12,7 +12,6 @@ b() } else { c() } -} if num := 9; num < 0 { d() } else if num < 10 { @@ -20,3 +19,4 @@ e() } else { f() } +} diff --git a/test/fixtures/go/if-statements.B.go b/test/fixtures/go/if-statements.B.go index f9f99092e..8d8b08e01 100644 --- a/test/fixtures/go/if-statements.B.go +++ b/test/fixtures/go/if-statements.B.go @@ -12,7 +12,6 @@ b() } else { c() } -} if num := 10; num < 0 { f() } else if num < 100 { @@ -20,3 +19,4 @@ g() } else { h() } +} diff --git a/test/fixtures/go/if-statements.diffA-B.txt b/test/fixtures/go/if-statements.diffA-B.txt index 2c8158f1d..22477d466 100644 --- a/test/fixtures/go/if-statements.diffA-B.txt +++ b/test/fixtures/go/if-statements.diffA-B.txt @@ -34,4 +34,36 @@ (Other "else_clause" (ExpressionStatements (FunctionCall - (Identifier))))))) + (Identifier))))) + (If + (Other "if_initializer" + (VarDecl + (Other "expression_list" + (Identifier)) + (Other "expression_list" + { (NumberLiteral) + ->(NumberLiteral) }))) + (RelationalOperator + (Identifier) + (Other "<") + (NumberLiteral)) + (ExpressionStatements + (FunctionCall + { (Identifier) + ->(Identifier) })) + (Other "else_clause" + (If + (RelationalOperator + (Identifier) + (Other "<") + { (NumberLiteral) + ->(NumberLiteral) }) + (ExpressionStatements + (FunctionCall + { (Identifier) + ->(Identifier) })) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + { (Identifier) + ->(Identifier) })))))))) diff --git a/test/fixtures/go/if-statements.diffB-A.txt b/test/fixtures/go/if-statements.diffB-A.txt index 2c8158f1d..22477d466 100644 --- a/test/fixtures/go/if-statements.diffB-A.txt +++ b/test/fixtures/go/if-statements.diffB-A.txt @@ -34,4 +34,36 @@ (Other "else_clause" (ExpressionStatements (FunctionCall - (Identifier))))))) + (Identifier))))) + (If + (Other "if_initializer" + (VarDecl + (Other "expression_list" + (Identifier)) + (Other "expression_list" + { (NumberLiteral) + ->(NumberLiteral) }))) + (RelationalOperator + (Identifier) + (Other "<") + (NumberLiteral)) + (ExpressionStatements + (FunctionCall + { (Identifier) + ->(Identifier) })) + (Other "else_clause" + (If + (RelationalOperator + (Identifier) + (Other "<") + { (NumberLiteral) + ->(NumberLiteral) }) + (ExpressionStatements + (FunctionCall + { (Identifier) + ->(Identifier) })) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + { (Identifier) + ->(Identifier) })))))))) diff --git a/test/fixtures/go/if-statements.parseA.txt b/test/fixtures/go/if-statements.parseA.txt index 99c85c436..5820b7e94 100644 --- a/test/fixtures/go/if-statements.parseA.txt +++ b/test/fixtures/go/if-statements.parseA.txt @@ -31,4 +31,31 @@ (Other "else_clause" (ExpressionStatements (FunctionCall - (Identifier))))))) + (Identifier))))) + (If + (Other "if_initializer" + (VarDecl + (Other "expression_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral)))) + (RelationalOperator + (Identifier) + (Other "<") + (NumberLiteral)) + (ExpressionStatements + (FunctionCall + (Identifier))) + (Other "else_clause" + (If + (RelationalOperator + (Identifier) + (Other "<") + (NumberLiteral)) + (ExpressionStatements + (FunctionCall + (Identifier))) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + (Identifier))))))))) diff --git a/test/fixtures/go/if-statements.parseB.txt b/test/fixtures/go/if-statements.parseB.txt index 99c85c436..5820b7e94 100644 --- a/test/fixtures/go/if-statements.parseB.txt +++ b/test/fixtures/go/if-statements.parseB.txt @@ -31,4 +31,31 @@ (Other "else_clause" (ExpressionStatements (FunctionCall - (Identifier))))))) + (Identifier))))) + (If + (Other "if_initializer" + (VarDecl + (Other "expression_list" + (Identifier)) + (Other "expression_list" + (NumberLiteral)))) + (RelationalOperator + (Identifier) + (Other "<") + (NumberLiteral)) + (ExpressionStatements + (FunctionCall + (Identifier))) + (Other "else_clause" + (If + (RelationalOperator + (Identifier) + (Other "<") + (NumberLiteral)) + (ExpressionStatements + (FunctionCall + (Identifier))) + (Other "else_clause" + (ExpressionStatements + (FunctionCall + (Identifier))))))))) From 0a6d48174f77a304f570220bab73a08ef6cd89d7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 16:14:35 -0700 Subject: [PATCH 018/176] Use Go Assignment --- src/Parser.hs | 5 +++-- src/Semantic.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Parser.hs b/src/Parser.hs index 542af4d4b..5c5c5b55b 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -70,7 +70,8 @@ data SomeParser typeclasses where -- This can be used to perform operations uniformly over terms produced by blobs with different 'Language's, and which therefore have different types in general. For example, given some 'Blob', we can parse and 'show' the parsed & assigned 'Term' like so: -- -- > case someParser (Proxy :: Proxy '[Show1]) (blobLanguage language) of { Just (SomeParser parser) -> runTask (parse parser blob) >>= putStrLn . show ; _ -> return () } -someParser :: ( ApplyAll typeclasses JSON.Syntax +someParser :: ( ApplyAll typeclasses Go.Syntax + , ApplyAll typeclasses JSON.Syntax , ApplyAll typeclasses Markdown.Syntax , ApplyAll typeclasses Python.Syntax , ApplyAll typeclasses Ruby.Syntax @@ -79,7 +80,7 @@ someParser :: ( ApplyAll typeclasses JSON.Syntax => proxy typeclasses -- ^ A proxy for the list of typeclasses required, e.g. @(Proxy :: Proxy '[Show1])@. -> Language -- ^ The 'Language' to select. -> Maybe (SomeParser typeclasses) -- ^ 'Maybe' a 'SomeParser' abstracting the syntax type to be produced. -someParser _ Go = Nothing +someParser _ Go = Just (SomeParser goParser) someParser _ JavaScript = Just (SomeParser typescriptParser) someParser _ JSON = Just (SomeParser jsonParser) someParser _ JSX = Just (SomeParser typescriptParser) diff --git a/src/Semantic.hs b/src/Semantic.hs index e486a0b7b..8c8232871 100644 --- a/src/Semantic.hs +++ b/src/Semantic.hs @@ -77,7 +77,7 @@ diffBlobPairs renderer = fmap toOutput . distributeFoldMap (diffBlobPair rendere diffBlobPair :: DiffRenderer output -> Both Blob -> Task output diffBlobPair renderer blobs = case (renderer, effectiveLanguage) of (OldToCDiffRenderer, lang) - | lang `elem` [ Just Language.Markdown, Just Language.Python, Just Language.Ruby ] + | lang `elem` [ Just Language.Go, Just Language.Markdown, Just Language.Python, Just Language.Ruby ] , Just (SomeParser parser) <- lang >>= someParser (Proxy :: Proxy '[Diffable, Eq1, Foldable, Functor, GAlign, HasDeclaration, Show1, Traversable]) -> run (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob)) diffTerms (renderToCDiff blobs) | Just syntaxParser <- lang >>= syntaxParserForLanguage -> From e9fc6263029f93fdc4f070cc215c168886bb8ace Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 16:14:46 -0700 Subject: [PATCH 019/176] Regenerate tests for Go Assignment --- test/fixtures/go/array-types.diffA-B.txt | 19 ++- test/fixtures/go/array-types.diffB-A.txt | 19 ++- test/fixtures/go/array-types.parseA.txt | 15 +-- test/fixtures/go/array-types.parseB.txt | 15 +-- .../go/array-with-implicit-length.diffA-B.txt | 27 ++-- .../go/array-with-implicit-length.diffB-A.txt | 27 ++-- .../go/array-with-implicit-length.parseA.txt | 21 ++- .../go/array-with-implicit-length.parseB.txt | 21 ++- .../go/assignment-statements.diffA-B.txt | 80 +++++------ .../go/assignment-statements.diffB-A.txt | 80 +++++------ .../go/assignment-statements.parseA.txt | 67 +++++----- .../go/assignment-statements.parseB.txt | 67 +++++----- test/fixtures/go/call-expressions.diffA-B.txt | 27 +--- test/fixtures/go/call-expressions.diffB-A.txt | 27 +--- test/fixtures/go/call-expressions.parseA.txt | 18 +-- test/fixtures/go/call-expressions.parseB.txt | 18 +-- test/fixtures/go/case-statements.diffA-B.txt | 11 +- test/fixtures/go/case-statements.diffB-A.txt | 11 +- test/fixtures/go/case-statements.parseA.txt | 5 +- test/fixtures/go/case-statements.parseB.txt | 11 +- test/fixtures/go/channel-types.diffA-B.txt | 36 ++--- test/fixtures/go/channel-types.diffB-A.txt | 30 ++--- test/fixtures/go/channel-types.parseA.txt | 22 ++-- test/fixtures/go/channel-types.parseB.txt | 22 ++-- test/fixtures/go/comment.diffA-B.txt | 2 +- test/fixtures/go/comment.diffB-A.txt | 2 +- test/fixtures/go/comment.parseA.txt | 2 +- test/fixtures/go/comment.parseB.txt | 2 +- .../const-declarations-with-types.diffA-B.txt | 24 ++-- .../const-declarations-with-types.diffB-A.txt | 26 ++-- .../const-declarations-with-types.parseA.txt | 14 +- .../const-declarations-with-types.parseB.txt | 19 +-- ...nst-declarations-without-types.diffA-B.txt | 20 ++- ...nst-declarations-without-types.diffB-A.txt | 20 ++- ...onst-declarations-without-types.parseA.txt | 10 +- ...onst-declarations-without-types.parseB.txt | 14 +- .../go/const-with-implicit-values.diffA-B.txt | 19 +-- .../go/const-with-implicit-values.diffB-A.txt | 19 +-- .../go/const-with-implicit-values.parseA.txt | 17 +-- .../go/const-with-implicit-values.parseB.txt | 17 +-- test/fixtures/go/constructors.diffA-B.txt | 37 +----- test/fixtures/go/constructors.diffB-A.txt | 37 +----- test/fixtures/go/constructors.parseA.txt | 30 +---- test/fixtures/go/constructors.parseB.txt | 30 +---- test/fixtures/go/float-literals.diffA-B.txt | 38 +----- test/fixtures/go/float-literals.diffB-A.txt | 38 +----- test/fixtures/go/float-literals.parseA.txt | 33 +---- test/fixtures/go/float-literals.parseB.txt | 33 +---- test/fixtures/go/for-statements.diffA-B.txt | 80 +---------- test/fixtures/go/for-statements.diffB-A.txt | 73 +---------- test/fixtures/go/for-statements.parseA.txt | 47 +------ test/fixtures/go/for-statements.parseB.txt | 37 +----- .../go/function-declarations.diffA-B.txt | 42 ++---- .../go/function-declarations.diffB-A.txt | 42 ++---- .../go/function-declarations.parseA.txt | 40 ++---- .../go/function-declarations.parseB.txt | 40 ++---- .../fixtures/go/function-literals.diffA-B.txt | 18 +-- .../fixtures/go/function-literals.diffB-A.txt | 18 +-- test/fixtures/go/function-literals.parseA.txt | 16 +-- test/fixtures/go/function-literals.parseB.txt | 16 +-- test/fixtures/go/function-types.diffA-B.txt | 31 ++--- test/fixtures/go/function-types.diffB-A.txt | 31 ++--- test/fixtures/go/function-types.parseA.txt | 22 ++-- test/fixtures/go/function-types.parseB.txt | 27 ++-- .../go/go-and-defer-statements.diffA-B.txt | 18 +-- .../go/go-and-defer-statements.diffB-A.txt | 18 +-- .../go/go-and-defer-statements.parseA.txt | 14 +- .../go/go-and-defer-statements.parseB.txt | 14 +- .../grouped-import-declarations.diffA-B.txt | 21 ++- .../grouped-import-declarations.diffB-A.txt | 21 ++- .../go/grouped-import-declarations.parseA.txt | 15 +-- .../go/grouped-import-declarations.parseB.txt | 15 +-- .../go/grouped-var-declarations.diffA-B.txt | 14 +- .../go/grouped-var-declarations.diffB-A.txt | 14 +- .../go/grouped-var-declarations.parseA.txt | 14 +- .../go/grouped-var-declarations.parseB.txt | 14 +- test/fixtures/go/if-statements.diffA-B.txt | 124 +++++++++--------- test/fixtures/go/if-statements.diffB-A.txt | 124 +++++++++--------- test/fixtures/go/if-statements.parseA.txt | 110 ++++++++-------- test/fixtures/go/if-statements.parseB.txt | 110 ++++++++-------- .../go/imaginary-literals.diffA-B.txt | 16 +-- .../go/imaginary-literals.diffB-A.txt | 16 +-- .../fixtures/go/imaginary-literals.parseA.txt | 14 +- .../fixtures/go/imaginary-literals.parseB.txt | 14 +- ...increment-decrement-statements.diffA-B.txt | 14 +- ...increment-decrement-statements.diffB-A.txt | 14 +- .../increment-decrement-statements.parseA.txt | 9 +- .../increment-decrement-statements.parseB.txt | 9 +- .../go/indexing-expressions.diffA-B.txt | 34 +---- .../go/indexing-expressions.diffB-A.txt | 33 +---- .../go/indexing-expressions.parseA.txt | 25 +--- .../go/indexing-expressions.parseB.txt | 26 +--- test/fixtures/go/int-literals.diffA-B.txt | 25 ++-- test/fixtures/go/int-literals.diffB-A.txt | 25 ++-- test/fixtures/go/int-literals.parseA.txt | 19 ++- test/fixtures/go/int-literals.parseB.txt | 19 ++- test/fixtures/go/interface-types.diffA-B.txt | 43 +++--- test/fixtures/go/interface-types.diffB-A.txt | 43 +++--- test/fixtures/go/interface-types.parseA.txt | 35 ++--- test/fixtures/go/interface-types.parseB.txt | 35 ++--- test/fixtures/go/label-statements.diffA-B.txt | 7 +- test/fixtures/go/label-statements.diffB-A.txt | 7 +- test/fixtures/go/label-statements.parseA.txt | 6 +- test/fixtures/go/label-statements.parseB.txt | 6 +- test/fixtures/go/map-literals.diffA-B.txt | 39 +++--- test/fixtures/go/map-literals.diffB-A.txt | 39 +++--- test/fixtures/go/map-literals.parseA.txt | 29 ++-- test/fixtures/go/map-literals.parseB.txt | 29 ++-- test/fixtures/go/map-types.diffA-B.txt | 8 +- test/fixtures/go/map-types.diffB-A.txt | 8 +- test/fixtures/go/map-types.parseA.txt | 8 +- test/fixtures/go/map-types.parseB.txt | 8 +- .../go/method-declarations.diffA-B.txt | 23 ++-- .../go/method-declarations.diffB-A.txt | 23 ++-- .../go/method-declarations.parseA.txt | 19 ++- .../go/method-declarations.parseB.txt | 19 ++- .../go/modifying-struct-fields.diffA-B.txt | 21 ++- .../go/modifying-struct-fields.diffB-A.txt | 21 ++- .../go/modifying-struct-fields.parseA.txt | 17 ++- .../go/modifying-struct-fields.parseB.txt | 21 ++- ...ameter-declarations-with-types.diffA-B.txt | 26 ++-- ...ameter-declarations-with-types.diffB-A.txt | 26 ++-- ...rameter-declarations-with-types.parseA.txt | 18 +-- ...rameter-declarations-with-types.parseB.txt | 18 +-- test/fixtures/go/pointer-types.diffA-B.txt | 14 +- test/fixtures/go/pointer-types.diffB-A.txt | 14 +- test/fixtures/go/pointer-types.parseA.txt | 14 +- test/fixtures/go/pointer-types.parseB.txt | 14 +- test/fixtures/go/qualified-types.diffA-B.txt | 13 +- test/fixtures/go/qualified-types.diffB-A.txt | 13 +- test/fixtures/go/qualified-types.parseA.txt | 10 +- test/fixtures/go/qualified-types.parseB.txt | 10 +- test/fixtures/go/rune-literals.diffA-B.txt | 38 ++---- test/fixtures/go/rune-literals.diffB-A.txt | 38 ++---- test/fixtures/go/rune-literals.parseA.txt | 32 ++--- test/fixtures/go/rune-literals.parseB.txt | 32 ++--- .../fixtures/go/select-statements.diffA-B.txt | 37 +----- .../fixtures/go/select-statements.diffB-A.txt | 37 +----- test/fixtures/go/select-statements.parseA.txt | 34 +---- test/fixtures/go/select-statements.parseB.txt | 34 +---- .../go/selector-expressions.diffA-B.txt | 12 +- .../go/selector-expressions.diffB-A.txt | 12 +- .../go/selector-expressions.parseA.txt | 9 +- .../go/selector-expressions.parseB.txt | 9 +- test/fixtures/go/send-statements.diffA-B.txt | 9 +- test/fixtures/go/send-statements.diffB-A.txt | 9 +- test/fixtures/go/send-statements.parseA.txt | 7 +- test/fixtures/go/send-statements.parseB.txt | 7 +- .../go/short-var-declarations.diffA-B.txt | 16 +-- .../go/short-var-declarations.diffB-A.txt | 16 +-- .../go/short-var-declarations.parseA.txt | 12 +- .../go/short-var-declarations.parseB.txt | 12 +- .../go/single-import-declarations.diffA-B.txt | 25 ++-- .../go/single-import-declarations.diffB-A.txt | 25 ++-- .../go/single-import-declarations.parseA.txt | 19 ++- .../go/single-import-declarations.parseB.txt | 19 ++- ...gle-line-function-declarations.diffA-B.txt | 36 +++-- ...gle-line-function-declarations.diffB-A.txt | 36 +++-- ...ngle-line-function-declarations.parseA.txt | 36 +++-- ...ngle-line-function-declarations.parseB.txt | 36 +++-- test/fixtures/go/slice-literals.diffA-B.txt | 53 ++++---- test/fixtures/go/slice-literals.diffB-A.txt | 53 ++++---- test/fixtures/go/slice-literals.parseA.txt | 45 +++---- test/fixtures/go/slice-literals.parseB.txt | 47 +++---- test/fixtures/go/slice-types.diffA-B.txt | 31 ++--- test/fixtures/go/slice-types.diffB-A.txt | 31 ++--- test/fixtures/go/slice-types.parseA.txt | 25 ++-- test/fixtures/go/slice-types.parseB.txt | 25 ++-- test/fixtures/go/string-literals.diffA-B.txt | 18 ++- test/fixtures/go/string-literals.diffB-A.txt | 18 ++- test/fixtures/go/string-literals.parseA.txt | 14 +- test/fixtures/go/string-literals.parseB.txt | 14 +- .../go/struct-field-declarations.diffA-B.txt | 21 +-- .../go/struct-field-declarations.diffB-A.txt | 21 +-- .../go/struct-field-declarations.parseA.txt | 15 ++- .../go/struct-field-declarations.parseB.txt | 14 +- test/fixtures/go/struct-literals.diffA-B.txt | 56 ++++---- test/fixtures/go/struct-literals.diffB-A.txt | 56 ++++---- test/fixtures/go/struct-literals.parseA.txt | 49 ++++--- test/fixtures/go/struct-literals.parseB.txt | 49 ++++--- test/fixtures/go/struct-types.diffA-B.txt | 65 +++++---- test/fixtures/go/struct-types.diffB-A.txt | 65 +++++---- test/fixtures/go/struct-types.parseA.txt | 57 ++++---- test/fixtures/go/struct-types.parseB.txt | 57 ++++---- .../fixtures/go/switch-statements.diffA-B.txt | 47 +------ .../fixtures/go/switch-statements.diffB-A.txt | 52 +------- test/fixtures/go/switch-statements.parseA.txt | 32 +---- test/fixtures/go/switch-statements.parseB.txt | 32 +---- .../go/type-assertion-expressions.diffA-B.txt | 9 +- .../go/type-assertion-expressions.diffB-A.txt | 9 +- .../go/type-assertion-expressions.parseA.txt | 7 +- .../go/type-assertion-expressions.parseB.txt | 7 +- .../type-conversion-expressions.diffA-B.txt | 39 +----- .../type-conversion-expressions.diffB-A.txt | 39 +----- .../go/type-conversion-expressions.parseA.txt | 27 +--- .../go/type-conversion-expressions.parseB.txt | 27 +--- .../fixtures/go/type-declarations.diffA-B.txt | 22 +--- .../fixtures/go/type-declarations.diffB-A.txt | 22 +--- test/fixtures/go/type-declarations.parseA.txt | 16 +-- test/fixtures/go/type-declarations.parseB.txt | 16 +-- .../go/type-switch-statements.diffA-B.txt | 18 +-- .../go/type-switch-statements.diffB-A.txt | 18 +-- .../go/type-switch-statements.parseA.txt | 17 +-- .../go/type-switch-statements.parseB.txt | 17 +-- .../fixtures/go/unary-expressions.diffA-B.txt | 14 +- .../fixtures/go/unary-expressions.diffB-A.txt | 14 +- test/fixtures/go/unary-expressions.parseA.txt | 12 +- test/fixtures/go/unary-expressions.parseB.txt | 12 +- ...clarations-with-no-expressions.diffA-B.txt | 31 +++-- ...clarations-with-no-expressions.diffB-A.txt | 31 +++-- ...eclarations-with-no-expressions.parseA.txt | 25 ++-- ...eclarations-with-no-expressions.parseB.txt | 25 ++-- .../var-declarations-with-types.diffA-B.txt | 38 +++--- .../var-declarations-with-types.diffB-A.txt | 38 +++--- .../go/var-declarations-with-types.parseA.txt | 32 ++--- .../go/var-declarations-with-types.parseB.txt | 32 ++--- ...var-declarations-without-types.diffA-B.txt | 20 ++- ...var-declarations-without-types.diffB-A.txt | 20 ++- .../var-declarations-without-types.parseA.txt | 10 +- .../var-declarations-without-types.parseB.txt | 14 +- ...variadic-function-declarations.diffA-B.txt | 38 +++--- ...variadic-function-declarations.diffB-A.txt | 38 +++--- .../variadic-function-declarations.parseA.txt | 34 ++--- .../variadic-function-declarations.parseB.txt | 34 ++--- 224 files changed, 2267 insertions(+), 3716 deletions(-) diff --git a/test/fixtures/go/array-types.diffA-B.txt b/test/fixtures/go/array-types.diffA-B.txt index 524b43e46..f616d322b 100644 --- a/test/fixtures/go/array-types.diffA-B.txt +++ b/test/fixtures/go/array-types.diffA-B.txt @@ -2,17 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (ArrayTy - (RelationalOperator - { (NumberLiteral) - ->(NumberLiteral) } - (Other "+") - { (NumberLiteral) - ->(NumberLiteral) }) + (Array + (Plus + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) }) { (Identifier) ->(Identifier) }))))) diff --git a/test/fixtures/go/array-types.diffB-A.txt b/test/fixtures/go/array-types.diffB-A.txt index 524b43e46..f616d322b 100644 --- a/test/fixtures/go/array-types.diffB-A.txt +++ b/test/fixtures/go/array-types.diffB-A.txt @@ -2,17 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (ArrayTy - (RelationalOperator - { (NumberLiteral) - ->(NumberLiteral) } - (Other "+") - { (NumberLiteral) - ->(NumberLiteral) }) + (Array + (Plus + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) }) { (Identifier) ->(Identifier) }))))) diff --git a/test/fixtures/go/array-types.parseA.txt b/test/fixtures/go/array-types.parseA.txt index 8bb054b7b..f9653b483 100644 --- a/test/fixtures/go/array-types.parseA.txt +++ b/test/fixtures/go/array-types.parseA.txt @@ -2,14 +2,13 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (ArrayTy - (RelationalOperator - (NumberLiteral) - (Other "+") - (NumberLiteral)) + (Array + (Plus + (Integer) + (Integer)) (Identifier)))))) diff --git a/test/fixtures/go/array-types.parseB.txt b/test/fixtures/go/array-types.parseB.txt index 8bb054b7b..f9653b483 100644 --- a/test/fixtures/go/array-types.parseB.txt +++ b/test/fixtures/go/array-types.parseB.txt @@ -2,14 +2,13 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (ArrayTy - (RelationalOperator - (NumberLiteral) - (Other "+") - (NumberLiteral)) + (Array + (Plus + (Integer) + (Integer)) (Identifier)))))) diff --git a/test/fixtures/go/array-with-implicit-length.diffA-B.txt b/test/fixtures/go/array-with-implicit-length.diffA-B.txt index b9cadd513..fe87c3001 100644 --- a/test/fixtures/go/array-with-implicit-length.diffA-B.txt +++ b/test/fixtures/go/array-with-implicit-length.diffA-B.txt @@ -2,18 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (ArrayTy - (Identifier)) - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) } - {+(NumberLiteral)+} - {-(NumberLiteral)-})))))) + (Assignment + (Identifier) + (Composite + (Array + (Identifier)) + ( + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) }))))) diff --git a/test/fixtures/go/array-with-implicit-length.diffB-A.txt b/test/fixtures/go/array-with-implicit-length.diffB-A.txt index b9cadd513..fe87c3001 100644 --- a/test/fixtures/go/array-with-implicit-length.diffB-A.txt +++ b/test/fixtures/go/array-with-implicit-length.diffB-A.txt @@ -2,18 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (ArrayTy - (Identifier)) - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) } - {+(NumberLiteral)+} - {-(NumberLiteral)-})))))) + (Assignment + (Identifier) + (Composite + (Array + (Identifier)) + ( + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) }))))) diff --git a/test/fixtures/go/array-with-implicit-length.parseA.txt b/test/fixtures/go/array-with-implicit-length.parseA.txt index 5943bfef3..48ff09a57 100644 --- a/test/fixtures/go/array-with-implicit-length.parseA.txt +++ b/test/fixtures/go/array-with-implicit-length.parseA.txt @@ -2,15 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (ArrayTy - (Identifier)) - (NumberLiteral) - (NumberLiteral) - (NumberLiteral))))))) + (Assignment + (Identifier) + (Composite + (Array + (Identifier)) + ( + (Integer) + (Integer) + (Integer)))))) diff --git a/test/fixtures/go/array-with-implicit-length.parseB.txt b/test/fixtures/go/array-with-implicit-length.parseB.txt index 5943bfef3..48ff09a57 100644 --- a/test/fixtures/go/array-with-implicit-length.parseB.txt +++ b/test/fixtures/go/array-with-implicit-length.parseB.txt @@ -2,15 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (ArrayTy - (Identifier)) - (NumberLiteral) - (NumberLiteral) - (NumberLiteral))))))) + (Assignment + (Identifier) + (Composite + (Array + (Identifier)) + ( + (Integer) + (Integer) + (Integer)))))) diff --git a/test/fixtures/go/assignment-statements.diffA-B.txt b/test/fixtures/go/assignment-statements.diffA-B.txt index 3f4f26dce..32e932195 100644 --- a/test/fixtures/go/assignment-statements.diffA-B.txt +++ b/test/fixtures/go/assignment-statements.diffA-B.txt @@ -2,46 +2,52 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" + ( + (Assignment { (Identifier) ->(Identifier) } - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))) - (Assignment - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy + (Integer)) + (Assignment + ( { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (Operator - (Other "composite_literal" + ->(Identifier) } + (Identifier)) + (Plus + ( + { (Identifier) + ->(Identifier) } + (Identifier)) + ( + (Integer) + (Integer)))) + (Assignment + { (Identifier) + ->(Identifier) } + (Times + { (Identifier) + ->(Identifier) } + (Integer))) + (Assignment + { (Identifier) + ->(Identifier) } + (Plus + { (Identifier) + ->(Identifier) } + (Integer))) + (Assignment + (Identifier) + ( + (Pointer + { (Identifier) + ->(Identifier) }) + (Reference + (Composite { (Identifier) ->(Identifier) } - (Pair - { (Identifier) - ->(Identifier) } - (NumberLiteral))))))))) + ( + (KeyValue + { (Identifier) + ->(Identifier) } + (Integer)))))))))) diff --git a/test/fixtures/go/assignment-statements.diffB-A.txt b/test/fixtures/go/assignment-statements.diffB-A.txt index 3f4f26dce..32e932195 100644 --- a/test/fixtures/go/assignment-statements.diffB-A.txt +++ b/test/fixtures/go/assignment-statements.diffB-A.txt @@ -2,46 +2,52 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" + ( + (Assignment { (Identifier) ->(Identifier) } - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))) - (Assignment - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy + (Integer)) + (Assignment + ( { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (Operator - (Other "composite_literal" + ->(Identifier) } + (Identifier)) + (Plus + ( + { (Identifier) + ->(Identifier) } + (Identifier)) + ( + (Integer) + (Integer)))) + (Assignment + { (Identifier) + ->(Identifier) } + (Times + { (Identifier) + ->(Identifier) } + (Integer))) + (Assignment + { (Identifier) + ->(Identifier) } + (Plus + { (Identifier) + ->(Identifier) } + (Integer))) + (Assignment + (Identifier) + ( + (Pointer + { (Identifier) + ->(Identifier) }) + (Reference + (Composite { (Identifier) ->(Identifier) } - (Pair - { (Identifier) - ->(Identifier) } - (NumberLiteral))))))))) + ( + (KeyValue + { (Identifier) + ->(Identifier) } + (Integer)))))))))) diff --git a/test/fixtures/go/assignment-statements.parseA.txt b/test/fixtures/go/assignment-statements.parseA.txt index 5d74921f0..fb76569f5 100644 --- a/test/fixtures/go/assignment-statements.parseA.txt +++ b/test/fixtures/go/assignment-statements.parseA.txt @@ -2,39 +2,42 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" + ( + (Assignment (Identifier) - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy + (Integer)) + (Assignment + ( + (Identifier) (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" + (Plus + ( + (Identifier) + (Identifier)) + ( + (Integer) + (Integer)))) + (Assignment + (Identifier) + (Times + (Identifier) + (Integer))) + (Assignment + (Identifier) + (Plus + (Identifier) + (Integer))) + (Assignment + (Identifier) + ( + (Pointer + (Identifier)) + (Reference + (Composite (Identifier) - (Pair - (Identifier) - (NumberLiteral))))))))) + ( + (KeyValue + (Identifier) + (Integer)))))))))) diff --git a/test/fixtures/go/assignment-statements.parseB.txt b/test/fixtures/go/assignment-statements.parseB.txt index 5d74921f0..fb76569f5 100644 --- a/test/fixtures/go/assignment-statements.parseB.txt +++ b/test/fixtures/go/assignment-statements.parseB.txt @@ -2,39 +2,42 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" + ( + (Assignment (Identifier) - (Identifier)) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (PointerTy + (Integer)) + (Assignment + ( + (Identifier) (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" + (Plus + ( + (Identifier) + (Identifier)) + ( + (Integer) + (Integer)))) + (Assignment + (Identifier) + (Times + (Identifier) + (Integer))) + (Assignment + (Identifier) + (Plus + (Identifier) + (Integer))) + (Assignment + (Identifier) + ( + (Pointer + (Identifier)) + (Reference + (Composite (Identifier) - (Pair - (Identifier) - (NumberLiteral))))))))) + ( + (KeyValue + (Identifier) + (Integer)))))))))) diff --git a/test/fixtures/go/call-expressions.diffA-B.txt b/test/fixtures/go/call-expressions.diffA-B.txt index 3df450c9a..5b61a91bb 100644 --- a/test/fixtures/go/call-expressions.diffA-B.txt +++ b/test/fixtures/go/call-expressions.diffA-B.txt @@ -2,26 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - {+(FunctionCall - {+(Identifier)+} - {+(Identifier)+} - {+(Identifier)+})+} - {+(FunctionCall - {+(Identifier)+} - {+(Identifier)+} - {+(Identifier)+})+} - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Identifier)) - {-(FunctionCall - {-(Identifier)-} - {-(Identifier)-} - {-(Identifier)-})-} - {-(FunctionCall - {-(Identifier)-} - {-(Identifier)-} - {-(Identifier)-})-})) + ( + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/call-expressions.diffB-A.txt b/test/fixtures/go/call-expressions.diffB-A.txt index 3df450c9a..5b61a91bb 100644 --- a/test/fixtures/go/call-expressions.diffB-A.txt +++ b/test/fixtures/go/call-expressions.diffB-A.txt @@ -2,26 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - {+(FunctionCall - {+(Identifier)+} - {+(Identifier)+} - {+(Identifier)+})+} - {+(FunctionCall - {+(Identifier)+} - {+(Identifier)+} - {+(Identifier)+})+} - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Identifier)) - {-(FunctionCall - {-(Identifier)-} - {-(Identifier)-} - {-(Identifier)-})-} - {-(FunctionCall - {-(Identifier)-} - {-(Identifier)-} - {-(Identifier)-})-})) + ( + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/call-expressions.parseA.txt b/test/fixtures/go/call-expressions.parseA.txt index 6f3b6a18c..5b61a91bb 100644 --- a/test/fixtures/go/call-expressions.parseA.txt +++ b/test/fixtures/go/call-expressions.parseA.txt @@ -2,17 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)))) + ( + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/call-expressions.parseB.txt b/test/fixtures/go/call-expressions.parseB.txt index 6f3b6a18c..5b61a91bb 100644 --- a/test/fixtures/go/call-expressions.parseB.txt +++ b/test/fixtures/go/call-expressions.parseB.txt @@ -2,17 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)))) + ( + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/case-statements.diffA-B.txt b/test/fixtures/go/case-statements.diffA-B.txt index 9a8995005..e31b62159 100644 --- a/test/fixtures/go/case-statements.diffA-B.txt +++ b/test/fixtures/go/case-statements.diffA-B.txt @@ -1,13 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - {+(Case - {+(Case - {+(Other "expression_list" - {+(Identifier)+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+}))) + (Error)) diff --git a/test/fixtures/go/case-statements.diffB-A.txt b/test/fixtures/go/case-statements.diffB-A.txt index fafa3f934..e31b62159 100644 --- a/test/fixtures/go/case-statements.diffB-A.txt +++ b/test/fixtures/go/case-statements.diffB-A.txt @@ -1,13 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - {-(Case - {-(Case - {-(Other "expression_list" - {-(Identifier)-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-}))) + (Error)) diff --git a/test/fixtures/go/case-statements.parseA.txt b/test/fixtures/go/case-statements.parseA.txt index 4c14d3944..e31b62159 100644 --- a/test/fixtures/go/case-statements.parseA.txt +++ b/test/fixtures/go/case-statements.parseA.txt @@ -1,7 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch))) + (Error)) diff --git a/test/fixtures/go/case-statements.parseB.txt b/test/fixtures/go/case-statements.parseB.txt index 38cd2778c..e31b62159 100644 --- a/test/fixtures/go/case-statements.parseB.txt +++ b/test/fixtures/go/case-statements.parseB.txt @@ -1,13 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (Identifier))) - (FunctionCall - (Identifier)))))) + (Error)) diff --git a/test/fixtures/go/channel-types.diffA-B.txt b/test/fixtures/go/channel-types.diffA-B.txt index 6351b17e3..85cb4138d 100644 --- a/test/fixtures/go/channel-types.diffA-B.txt +++ b/test/fixtures/go/channel-types.diffA-B.txt @@ -2,26 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (ChannelTy - (ChannelTy - { (Identifier) - ->(Identifier) }))) - (TypeDecl - { (Identifier) - ->(Identifier) } - (ChannelTy - (ChannelTy - (StructTy)))) - (TypeDecl - { (Identifier) - ->(Identifier) } - (ChannelTy - (ChannelTy - { (Identifier) - ->(Identifier) })))))) + ( + {-(Annotation + {-(Identifier)-} + {-(Error)-})-} + (Annotation + (Identifier) + (Error)) + (Annotation + (Identifier) + (Error)) + {+(Annotation + {+(Identifier)+} + {+(Error)+})+}))) diff --git a/test/fixtures/go/channel-types.diffB-A.txt b/test/fixtures/go/channel-types.diffB-A.txt index 6351b17e3..8644d7a44 100644 --- a/test/fixtures/go/channel-types.diffB-A.txt +++ b/test/fixtures/go/channel-types.diffB-A.txt @@ -2,26 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation { (Identifier) ->(Identifier) } - (ChannelTy - (ChannelTy - { (Identifier) - ->(Identifier) }))) - (TypeDecl - { (Identifier) - ->(Identifier) } - (ChannelTy - (ChannelTy - (StructTy)))) - (TypeDecl - { (Identifier) - ->(Identifier) } - (ChannelTy - (ChannelTy - { (Identifier) - ->(Identifier) })))))) + (Error)) + (Annotation + (Identifier) + (Error)) + (Annotation + (Identifier) + (Error))))) diff --git a/test/fixtures/go/channel-types.parseA.txt b/test/fixtures/go/channel-types.parseA.txt index 115f20846..5b73d0815 100644 --- a/test/fixtures/go/channel-types.parseA.txt +++ b/test/fixtures/go/channel-types.parseA.txt @@ -2,21 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (ChannelTy - (ChannelTy - (Identifier)))) - (TypeDecl + (Error)) + (Annotation (Identifier) - (ChannelTy - (ChannelTy - (StructTy)))) - (TypeDecl + (Error)) + (Annotation (Identifier) - (ChannelTy - (ChannelTy - (Identifier))))))) + (Error))))) diff --git a/test/fixtures/go/channel-types.parseB.txt b/test/fixtures/go/channel-types.parseB.txt index 115f20846..5b73d0815 100644 --- a/test/fixtures/go/channel-types.parseB.txt +++ b/test/fixtures/go/channel-types.parseB.txt @@ -2,21 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (ChannelTy - (ChannelTy - (Identifier)))) - (TypeDecl + (Error)) + (Annotation (Identifier) - (ChannelTy - (ChannelTy - (StructTy)))) - (TypeDecl + (Error)) + (Annotation (Identifier) - (ChannelTy - (ChannelTy - (Identifier))))))) + (Error))))) diff --git a/test/fixtures/go/comment.diffA-B.txt b/test/fixtures/go/comment.diffA-B.txt index e8e194c01..099b3b49f 100644 --- a/test/fixtures/go/comment.diffA-B.txt +++ b/test/fixtures/go/comment.diffA-B.txt @@ -2,7 +2,7 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) { (Comment) ->(Comment) })) diff --git a/test/fixtures/go/comment.diffB-A.txt b/test/fixtures/go/comment.diffB-A.txt index e8e194c01..099b3b49f 100644 --- a/test/fixtures/go/comment.diffB-A.txt +++ b/test/fixtures/go/comment.diffB-A.txt @@ -2,7 +2,7 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) { (Comment) ->(Comment) })) diff --git a/test/fixtures/go/comment.parseA.txt b/test/fixtures/go/comment.parseA.txt index 34bc6dfd4..be50dd587 100644 --- a/test/fixtures/go/comment.parseA.txt +++ b/test/fixtures/go/comment.parseA.txt @@ -2,6 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) (Comment))) diff --git a/test/fixtures/go/comment.parseB.txt b/test/fixtures/go/comment.parseB.txt index 34bc6dfd4..be50dd587 100644 --- a/test/fixtures/go/comment.parseB.txt +++ b/test/fixtures/go/comment.parseB.txt @@ -2,6 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) (Comment))) diff --git a/test/fixtures/go/const-declarations-with-types.diffA-B.txt b/test/fixtures/go/const-declarations-with-types.diffA-B.txt index 13a073d55..ca804897a 100644 --- a/test/fixtures/go/const-declarations-with-types.diffA-B.txt +++ b/test/fixtures/go/const-declarations-with-types.diffA-B.txt @@ -2,17 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - {+(Identifier)+} + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) } + {+(Identifier)+}) { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - {+(Other "expression_list" - {+(NumberLiteral)+} - {+(NumberLiteral)+})+} - {-(Other "expression_list" - {-(NumberLiteral)-})-})))) + ->(Identifier) }) + { (Integer) + ->( + {+(Integer)+} + {+(Integer)+}) }))) diff --git a/test/fixtures/go/const-declarations-with-types.diffB-A.txt b/test/fixtures/go/const-declarations-with-types.diffB-A.txt index 9f4ddb614..53f20f9bb 100644 --- a/test/fixtures/go/const-declarations-with-types.diffB-A.txt +++ b/test/fixtures/go/const-declarations-with-types.diffB-A.txt @@ -2,17 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - {+(Identifier)+} - {+(Identifier)+} - {+(Other "expression_list" - {+(NumberLiteral)+})+} - {-(Identifier)-} - {-(Identifier)-} - {-(Identifier)-} - {-(Other "expression_list" - {-(NumberLiteral)-} - {-(NumberLiteral)-})-})))) + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) } + {-(Identifier)-}) + { (Identifier) + ->(Identifier) }) + { ( + {-(Integer)-} + {-(Integer)-}) + ->(Integer) }))) diff --git a/test/fixtures/go/const-declarations-with-types.parseA.txt b/test/fixtures/go/const-declarations-with-types.parseA.txt index 6e97bd657..302b425b6 100644 --- a/test/fixtures/go/const-declarations-with-types.parseA.txt +++ b/test/fixtures/go/const-declarations-with-types.parseA.txt @@ -2,11 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Assignment + (Annotation + ( + (Identifier)) + (Identifier)) + (Integer)))) diff --git a/test/fixtures/go/const-declarations-with-types.parseB.txt b/test/fixtures/go/const-declarations-with-types.parseB.txt index ec590e183..89b145013 100644 --- a/test/fixtures/go/const-declarations-with-types.parseB.txt +++ b/test/fixtures/go/const-declarations-with-types.parseB.txt @@ -2,13 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + (Assignment + (Annotation + ( + (Identifier) + (Identifier)) + (Identifier)) + ( + (Integer) + (Integer))))) diff --git a/test/fixtures/go/const-declarations-without-types.diffA-B.txt b/test/fixtures/go/const-declarations-without-types.diffA-B.txt index 0a8633a32..804caeb9b 100644 --- a/test/fixtures/go/const-declarations-without-types.diffA-B.txt +++ b/test/fixtures/go/const-declarations-without-types.diffA-B.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - { (VarAssignment - {-(Identifier)-} - {-(Other "expression_list" - {-(NumberLiteral)-})-}) - ->(VarAssignment + (Assignment + { (Identifier) + ->( {+(Identifier)+} - {+(Identifier)+} - {+(Other "expression_list" - {+(NumberLiteral)+} - {+(NumberLiteral)+})+}) }))) + {+(Identifier)+}) } + { (Integer) + ->( + {+(Integer)+} + {+(Integer)+}) }))) diff --git a/test/fixtures/go/const-declarations-without-types.diffB-A.txt b/test/fixtures/go/const-declarations-without-types.diffB-A.txt index 18b97f981..7796835c1 100644 --- a/test/fixtures/go/const-declarations-without-types.diffB-A.txt +++ b/test/fixtures/go/const-declarations-without-types.diffB-A.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - { (VarAssignment + (Assignment + { ( {-(Identifier)-} - {-(Identifier)-} - {-(Other "expression_list" - {-(NumberLiteral)-} - {-(NumberLiteral)-})-}) - ->(VarAssignment - {+(Identifier)+} - {+(Other "expression_list" - {+(NumberLiteral)+})+}) }))) + {-(Identifier)-}) + ->(Identifier) } + { ( + {-(Integer)-} + {-(Integer)-}) + ->(Integer) }))) diff --git a/test/fixtures/go/const-declarations-without-types.parseA.txt b/test/fixtures/go/const-declarations-without-types.parseA.txt index e870edc99..a2d50974f 100644 --- a/test/fixtures/go/const-declarations-without-types.parseA.txt +++ b/test/fixtures/go/const-declarations-without-types.parseA.txt @@ -2,10 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Assignment + (Identifier) + (Integer)))) diff --git a/test/fixtures/go/const-declarations-without-types.parseB.txt b/test/fixtures/go/const-declarations-without-types.parseB.txt index 382f67fe0..bfcfcf674 100644 --- a/test/fixtures/go/const-declarations-without-types.parseB.txt +++ b/test/fixtures/go/const-declarations-without-types.parseB.txt @@ -2,12 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + (Assignment + ( (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + (Identifier)) + ( + (Integer) + (Integer))))) diff --git a/test/fixtures/go/const-with-implicit-values.diffA-B.txt b/test/fixtures/go/const-with-implicit-values.diffA-B.txt index 21b9a915c..7207d5dff 100644 --- a/test/fixtures/go/const-with-implicit-values.diffA-B.txt +++ b/test/fixtures/go/const-with-implicit-values.diffA-B.txt @@ -2,17 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment { (Identifier) ->(Identifier) } - (Other "expression_list" - (Identifier))) - (VarAssignment + (Identifier)) + (Assignment { (Identifier) - ->(Identifier) }) - (VarAssignment + ->(Identifier) } + ([])) + (Assignment { (Identifier) - ->(Identifier) })))) + ->(Identifier) } + ([]))))) diff --git a/test/fixtures/go/const-with-implicit-values.diffB-A.txt b/test/fixtures/go/const-with-implicit-values.diffB-A.txt index 21b9a915c..7207d5dff 100644 --- a/test/fixtures/go/const-with-implicit-values.diffB-A.txt +++ b/test/fixtures/go/const-with-implicit-values.diffB-A.txt @@ -2,17 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment { (Identifier) ->(Identifier) } - (Other "expression_list" - (Identifier))) - (VarAssignment + (Identifier)) + (Assignment { (Identifier) - ->(Identifier) }) - (VarAssignment + ->(Identifier) } + ([])) + (Assignment { (Identifier) - ->(Identifier) })))) + ->(Identifier) } + ([]))))) diff --git a/test/fixtures/go/const-with-implicit-values.parseA.txt b/test/fixtures/go/const-with-implicit-values.parseA.txt index 6906a9a18..5adf0aade 100644 --- a/test/fixtures/go/const-with-implicit-values.parseA.txt +++ b/test/fixtures/go/const-with-implicit-values.parseA.txt @@ -2,14 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Identifier))) - (VarAssignment (Identifier)) - (VarAssignment - (Identifier))))) + (Assignment + (Identifier) + ([])) + (Assignment + (Identifier) + ([]))))) diff --git a/test/fixtures/go/const-with-implicit-values.parseB.txt b/test/fixtures/go/const-with-implicit-values.parseB.txt index 6906a9a18..5adf0aade 100644 --- a/test/fixtures/go/const-with-implicit-values.parseB.txt +++ b/test/fixtures/go/const-with-implicit-values.parseB.txt @@ -2,14 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Identifier))) - (VarAssignment (Identifier)) - (VarAssignment - (Identifier))))) + (Assignment + (Identifier) + ([])) + (Assignment + (Identifier) + ([]))))) diff --git a/test/fixtures/go/constructors.diffA-B.txt b/test/fixtures/go/constructors.diffA-B.txt index 8f4721301..036e0af4b 100644 --- a/test/fixtures/go/constructors.diffA-B.txt +++ b/test/fixtures/go/constructors.diffA-B.txt @@ -2,35 +2,10 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) })) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) }) - (RelationalOperator - (Identifier) - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) }) - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) }) - (FunctionCall - (Identifier) - (DictionaryTy - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) + ( + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/constructors.diffB-A.txt b/test/fixtures/go/constructors.diffB-A.txt index 8f4721301..036e0af4b 100644 --- a/test/fixtures/go/constructors.diffB-A.txt +++ b/test/fixtures/go/constructors.diffB-A.txt @@ -2,35 +2,10 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) })) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) }) - (RelationalOperator - (Identifier) - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) }) - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) }) - (FunctionCall - (Identifier) - (DictionaryTy - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) + ( + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/constructors.parseA.txt b/test/fixtures/go/constructors.parseA.txt index df72dd0e0..036e0af4b 100644 --- a/test/fixtures/go/constructors.parseA.txt +++ b/test/fixtures/go/constructors.parseA.txt @@ -2,28 +2,10 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier)) - (RelationalOperator - (Identifier) - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier)) - (NumberLiteral) - (NumberLiteral)) - (FunctionCall - (Identifier) - (DictionaryTy - (Identifier) - (Identifier))))) + ( + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/constructors.parseB.txt b/test/fixtures/go/constructors.parseB.txt index df72dd0e0..036e0af4b 100644 --- a/test/fixtures/go/constructors.parseB.txt +++ b/test/fixtures/go/constructors.parseB.txt @@ -2,28 +2,10 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier)) - (RelationalOperator - (Identifier) - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier)) - (NumberLiteral) - (NumberLiteral)) - (FunctionCall - (Identifier) - (DictionaryTy - (Identifier) - (Identifier))))) + ( + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/float-literals.diffA-B.txt b/test/fixtures/go/float-literals.diffA-B.txt index d80138c90..e4d47eda0 100644 --- a/test/fixtures/go/float-literals.diffA-B.txt +++ b/test/fixtures/go/float-literals.diffA-B.txt @@ -2,35 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })))) + ( + (Error) + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/float-literals.diffB-A.txt b/test/fixtures/go/float-literals.diffB-A.txt index d80138c90..e4d47eda0 100644 --- a/test/fixtures/go/float-literals.diffB-A.txt +++ b/test/fixtures/go/float-literals.diffB-A.txt @@ -2,35 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (FloatLiteral) - ->(FloatLiteral) })))) + ( + (Error) + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/float-literals.parseA.txt b/test/fixtures/go/float-literals.parseA.txt index 662a4361b..e4d47eda0 100644 --- a/test/fixtures/go/float-literals.parseA.txt +++ b/test/fixtures/go/float-literals.parseA.txt @@ -2,30 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))))) + ( + (Error) + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/float-literals.parseB.txt b/test/fixtures/go/float-literals.parseB.txt index 662a4361b..e4d47eda0 100644 --- a/test/fixtures/go/float-literals.parseB.txt +++ b/test/fixtures/go/float-literals.parseB.txt @@ -2,30 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))) - (Assignment - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FloatLiteral))))) + ( + (Error) + (Error) + (Error) + (Error) + (Error)))) diff --git a/test/fixtures/go/for-statements.diffA-B.txt b/test/fixtures/go/for-statements.diffA-B.txt index f5ef5ab4f..e31b62159 100644 --- a/test/fixtures/go/for-statements.diffA-B.txt +++ b/test/fixtures/go/for-statements.diffA-B.txt @@ -1,82 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - { (For - {-(ExpressionStatements - {-(FunctionCall - {-(Identifier)-})-} - {-(Other "goto_statement" - {-(Identifier)-})-})-}) - ->(For - {+(FunctionCall - {+(Identifier)+})+} - {+(Other "goto_statement" - {+(Identifier)+})+}) } - {+(For - {+(Other "expression_list" - {+(Identifier)+})+} - {+(Identifier)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Break - {+(Identifier)+})+})+} - {+(For - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue - {+(Identifier)+})+})+} - {+(For - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(NumberLiteral)+})+} - {+(IncrementStatement)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue)+})+} - {+(For - {+(ExpressionStatements - {+(FunctionCall - {+(Identifier)+} - {+(Identifier)+})+} - {+(Break)+})+})+} - {-(For - {-(VarDecl - {-(Other "expression_list" - {-(Identifier)-})-} - {-(Other "expression_list" - {-(NumberLiteral)-})-})-} - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(NumberLiteral)-})-} - {-(IncrementStatement)-} - {-(FunctionCall - {-(Identifier)-})-} - {-(Break - {-(Identifier)-})-})-} - {-(For - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(NumberLiteral)-})-} - {-(IncrementStatement)-} - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue - {-(Identifier)-})-})-} - {-(For - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue)-})-} - {-(For - {-(Other "expression_list" - {-(Identifier)-})-} - {-(Identifier)-} - {-(FunctionCall - {-(Identifier)-} - {-(Identifier)-})-} - {-(Break)-})-})) + (Error)) diff --git a/test/fixtures/go/for-statements.diffB-A.txt b/test/fixtures/go/for-statements.diffB-A.txt index fd616ba39..e31b62159 100644 --- a/test/fixtures/go/for-statements.diffB-A.txt +++ b/test/fixtures/go/for-statements.diffB-A.txt @@ -1,75 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - { (For - {-(FunctionCall - {-(Identifier)-})-} - {-(Other "goto_statement" - {-(Identifier)-})-}) - ->(For - {+(ExpressionStatements - {+(FunctionCall - {+(Identifier)+})+} - {+(Other "goto_statement" - {+(Identifier)+})+})+}) } - {+(For - {+(VarDecl - {+(Other "expression_list" - {+(Identifier)+})+} - {+(Other "expression_list" - {+(NumberLiteral)+})+})+} - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(NumberLiteral)+})+} - {+(IncrementStatement)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Break - {+(Identifier)+})+})+} - {+(For - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(NumberLiteral)+})+} - {+(IncrementStatement)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue - {+(Identifier)+})+})+} - {+(For - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue)+})+} - (For - (Other "expression_list" - (Identifier)) - (Identifier) - (FunctionCall - (Identifier) - {+(Identifier)+}) - (Break - {-(Identifier)-})) - {-(For - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue - {-(Identifier)-})-})-} - {-(For - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(NumberLiteral)-})-} - {-(IncrementStatement)-} - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue)-})-} - {-(For - {-(ExpressionStatements - {-(FunctionCall - {-(Identifier)-} - {-(Identifier)-})-} - {-(Break)-})-})-})) + (Error)) diff --git a/test/fixtures/go/for-statements.parseA.txt b/test/fixtures/go/for-statements.parseA.txt index b63116cb6..e31b62159 100644 --- a/test/fixtures/go/for-statements.parseA.txt +++ b/test/fixtures/go/for-statements.parseA.txt @@ -1,49 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (For - (ExpressionStatements - (FunctionCall - (Identifier)) - (Other "goto_statement" - (Identifier)))) - (For - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral))) - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (IncrementStatement) - (FunctionCall - (Identifier)) - (Break - (Identifier))) - (For - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (IncrementStatement) - (FunctionCall - (Identifier)) - (Continue - (Identifier))) - (For - (FunctionCall - (Identifier)) - (Continue)) - (For - (Other "expression_list" - (Identifier)) - (Identifier) - (FunctionCall - (Identifier) - (Identifier)) - (Break)))) + (Error)) diff --git a/test/fixtures/go/for-statements.parseB.txt b/test/fixtures/go/for-statements.parseB.txt index f665ed2c8..e31b62159 100644 --- a/test/fixtures/go/for-statements.parseB.txt +++ b/test/fixtures/go/for-statements.parseB.txt @@ -1,39 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (For - (FunctionCall - (Identifier)) - (Other "goto_statement" - (Identifier))) - (For - (Other "expression_list" - (Identifier)) - (Identifier) - (FunctionCall - (Identifier)) - (Break - (Identifier))) - (For - (FunctionCall - (Identifier)) - (Continue - (Identifier))) - (For - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (IncrementStatement) - (FunctionCall - (Identifier)) - (Continue)) - (For - (ExpressionStatements - (FunctionCall - (Identifier) - (Identifier)) - (Break))))) + (Error)) diff --git a/test/fixtures/go/function-declarations.diffA-B.txt b/test/fixtures/go/function-declarations.diffA-B.txt index af79f31ad..25aebac20 100644 --- a/test/fixtures/go/function-declarations.diffA-B.txt +++ b/test/fixtures/go/function-declarations.diffA-B.txt @@ -2,40 +2,26 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args)) + ([])) (Function + (Identifier) { (Identifier) ->(Identifier) } - (Args - (ParameterDecl - (Identifier) - (Identifier)) + ( (Identifier) + (Identifier)) + (Identifier) + (Identifier) + ( (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (Identifier) - (Identifier))) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))) + (Identifier)) + ([])) + (Error) + (Error)) diff --git a/test/fixtures/go/function-declarations.diffB-A.txt b/test/fixtures/go/function-declarations.diffB-A.txt index af79f31ad..25aebac20 100644 --- a/test/fixtures/go/function-declarations.diffB-A.txt +++ b/test/fixtures/go/function-declarations.diffB-A.txt @@ -2,40 +2,26 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args)) + ([])) (Function + (Identifier) { (Identifier) ->(Identifier) } - (Args - (ParameterDecl - (Identifier) - (Identifier)) + ( (Identifier) + (Identifier)) + (Identifier) + (Identifier) + ( (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (Identifier) - (Identifier))) - (Function - { (Identifier) - ->(Identifier) } - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))) + (Identifier)) + ([])) + (Error) + (Error)) diff --git a/test/fixtures/go/function-declarations.parseA.txt b/test/fixtures/go/function-declarations.parseA.txt index 2ccf15e92..b45f5f054 100644 --- a/test/fixtures/go/function-declarations.parseA.txt +++ b/test/fixtures/go/function-declarations.parseA.txt @@ -2,36 +2,24 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) + (Function + (Empty) + (Identifier) + ([])) (Function (Identifier) - (Args)) - (Function (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) + ( (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function + (Identifier)) (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))) + ( + (Identifier) + (Identifier)) + ([])) + (Error) + (Error)) diff --git a/test/fixtures/go/function-declarations.parseB.txt b/test/fixtures/go/function-declarations.parseB.txt index 2ccf15e92..b45f5f054 100644 --- a/test/fixtures/go/function-declarations.parseB.txt +++ b/test/fixtures/go/function-declarations.parseB.txt @@ -2,36 +2,24 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) + (Function + (Empty) + (Identifier) + ([])) (Function (Identifier) - (Args)) - (Function (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) + ( (Identifier) - (Identifier) - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier)) - (Function + (Identifier)) (Identifier) - (Args) - (Args - (Identifier) - (Identifier))) - (Function (Identifier) - (Args) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))) + ( + (Identifier) + (Identifier)) + ([])) + (Error) + (Error)) diff --git a/test/fixtures/go/function-literals.diffA-B.txt b/test/fixtures/go/function-literals.diffA-B.txt index 5cb150fd7..ae2fde0a2 100644 --- a/test/fixtures/go/function-literals.diffA-B.txt +++ b/test/fixtures/go/function-literals.diffA-B.txt @@ -2,18 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (AnonymousFunction - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Return - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))))))))) + (Assignment + (Identifier) + (Error)))) diff --git a/test/fixtures/go/function-literals.diffB-A.txt b/test/fixtures/go/function-literals.diffB-A.txt index 5cb150fd7..ae2fde0a2 100644 --- a/test/fixtures/go/function-literals.diffB-A.txt +++ b/test/fixtures/go/function-literals.diffB-A.txt @@ -2,18 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (AnonymousFunction - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Return - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))))))))) + (Assignment + (Identifier) + (Error)))) diff --git a/test/fixtures/go/function-literals.parseA.txt b/test/fixtures/go/function-literals.parseA.txt index 936103051..ae2fde0a2 100644 --- a/test/fixtures/go/function-literals.parseA.txt +++ b/test/fixtures/go/function-literals.parseA.txt @@ -2,16 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (AnonymousFunction - (Identifier) - (Identifier) - (Return - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))))))))) + (Assignment + (Identifier) + (Error)))) diff --git a/test/fixtures/go/function-literals.parseB.txt b/test/fixtures/go/function-literals.parseB.txt index 936103051..ae2fde0a2 100644 --- a/test/fixtures/go/function-literals.parseB.txt +++ b/test/fixtures/go/function-literals.parseB.txt @@ -2,16 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (AnonymousFunction - (Identifier) - (Identifier) - (Return - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))))))))) + (Assignment + (Identifier) + (Error)))) diff --git a/test/fixtures/go/function-types.diffA-B.txt b/test/fixtures/go/function-types.diffA-B.txt index 8c6b9d894..cebfd4059 100644 --- a/test/fixtures/go/function-types.diffA-B.txt +++ b/test/fixtures/go/function-types.diffA-B.txt @@ -2,29 +2,26 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation { (Identifier) ->(Identifier) } - (FunctionTy - (Args - { (Identifier) - ->(Identifier) }) + (Function + { (Identifier) + ->(Identifier) } { (Identifier) ->(Identifier) })) - (TypeDecl + (Annotation { (Identifier) ->(Identifier) } - (FunctionTy - (Args - {-(Identifier)-} - (Identifier) - {+(Identifier)+}) - (Args - {+(ParameterDecl - {+(ChannelTy - {+(Identifier)+})+})+} + (Function + {-(Identifier)-} + (Identifier) + {+(Identifier)+} + ( + {+(BiDirectionalChannel + {+(Identifier)+})+} {-(Identifier)-} (Identifier))))))) diff --git a/test/fixtures/go/function-types.diffB-A.txt b/test/fixtures/go/function-types.diffB-A.txt index 0270a69be..bcb2228cc 100644 --- a/test/fixtures/go/function-types.diffB-A.txt +++ b/test/fixtures/go/function-types.diffB-A.txt @@ -2,29 +2,26 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation { (Identifier) ->(Identifier) } - (FunctionTy - (Args - { (Identifier) - ->(Identifier) }) + (Function + { (Identifier) + ->(Identifier) } { (Identifier) ->(Identifier) })) - (TypeDecl + (Annotation { (Identifier) ->(Identifier) } - (FunctionTy - (Args - {-(Identifier)-} - (Identifier) - {+(Identifier)+}) - (Args + (Function + {-(Identifier)-} + (Identifier) + {+(Identifier)+} + ( {+(Identifier)+} - {-(ParameterDecl - {-(ChannelTy - {-(Identifier)-})-})-} + {-(BiDirectionalChannel + {-(Identifier)-})-} (Identifier))))))) diff --git a/test/fixtures/go/function-types.parseA.txt b/test/fixtures/go/function-types.parseA.txt index 0903f2e70..c467cb392 100644 --- a/test/fixtures/go/function-types.parseA.txt +++ b/test/fixtures/go/function-types.parseA.txt @@ -2,21 +2,19 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (FunctionTy - (Args - (Identifier)) + (Function + (Identifier) (Identifier))) - (TypeDecl + (Annotation (Identifier) - (FunctionTy - (Args - (Identifier) - (Identifier)) - (Args + (Function + (Identifier) + (Identifier) + ( (Identifier) (Identifier))))))) diff --git a/test/fixtures/go/function-types.parseB.txt b/test/fixtures/go/function-types.parseB.txt index cfde6ab7f..a1a18c8ba 100644 --- a/test/fixtures/go/function-types.parseB.txt +++ b/test/fixtures/go/function-types.parseB.txt @@ -2,23 +2,20 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (FunctionTy - (Args - (Identifier)) + (Function + (Identifier) (Identifier))) - (TypeDecl + (Annotation (Identifier) - (FunctionTy - (Args - (Identifier) - (Identifier)) - (Args - (ParameterDecl - (ChannelTy - (Identifier))) + (Function + (Identifier) + (Identifier) + ( + (BiDirectionalChannel + (Identifier)) (Identifier))))))) diff --git a/test/fixtures/go/go-and-defer-statements.diffA-B.txt b/test/fixtures/go/go-and-defer-statements.diffA-B.txt index c657dff44..e31b62159 100644 --- a/test/fixtures/go/go-and-defer-statements.diffA-B.txt +++ b/test/fixtures/go/go-and-defer-statements.diffA-B.txt @@ -1,20 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Defer - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }))) - (Go - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }))))) + (Error)) diff --git a/test/fixtures/go/go-and-defer-statements.diffB-A.txt b/test/fixtures/go/go-and-defer-statements.diffB-A.txt index c657dff44..e31b62159 100644 --- a/test/fixtures/go/go-and-defer-statements.diffB-A.txt +++ b/test/fixtures/go/go-and-defer-statements.diffB-A.txt @@ -1,20 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Defer - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }))) - (Go - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }))))) + (Error)) diff --git a/test/fixtures/go/go-and-defer-statements.parseA.txt b/test/fixtures/go/go-and-defer-statements.parseA.txt index 17047c6c8..e31b62159 100644 --- a/test/fixtures/go/go-and-defer-statements.parseA.txt +++ b/test/fixtures/go/go-and-defer-statements.parseA.txt @@ -1,16 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Defer - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)))) - (Go - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)))))) + (Error)) diff --git a/test/fixtures/go/go-and-defer-statements.parseB.txt b/test/fixtures/go/go-and-defer-statements.parseB.txt index 17047c6c8..e31b62159 100644 --- a/test/fixtures/go/go-and-defer-statements.parseB.txt +++ b/test/fixtures/go/go-and-defer-statements.parseB.txt @@ -1,16 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Defer - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)))) - (Go - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)))))) + (Error)) diff --git a/test/fixtures/go/grouped-import-declarations.diffA-B.txt b/test/fixtures/go/grouped-import-declarations.diffA-B.txt index a798090ae..0c3d5f8a3 100644 --- a/test/fixtures/go/grouped-import-declarations.diffA-B.txt +++ b/test/fixtures/go/grouped-import-declarations.diffA-B.txt @@ -1,17 +1,16 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - { (StringLiteral) - ->(StringLiteral) }) - (Import - { (StringLiteral) - ->(StringLiteral) }) - (Import + (Import + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) } + ( (Identifier) - { (StringLiteral) - ->(StringLiteral) })) + { (TextElement) + ->(TextElement) })) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/grouped-import-declarations.diffB-A.txt b/test/fixtures/go/grouped-import-declarations.diffB-A.txt index a798090ae..0c3d5f8a3 100644 --- a/test/fixtures/go/grouped-import-declarations.diffB-A.txt +++ b/test/fixtures/go/grouped-import-declarations.diffB-A.txt @@ -1,17 +1,16 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - { (StringLiteral) - ->(StringLiteral) }) - (Import - { (StringLiteral) - ->(StringLiteral) }) - (Import + (Import + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) } + ( (Identifier) - { (StringLiteral) - ->(StringLiteral) })) + { (TextElement) + ->(TextElement) })) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/grouped-import-declarations.parseA.txt b/test/fixtures/go/grouped-import-declarations.parseA.txt index b81a856a3..17726f254 100644 --- a/test/fixtures/go/grouped-import-declarations.parseA.txt +++ b/test/fixtures/go/grouped-import-declarations.parseA.txt @@ -1,14 +1,13 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - (StringLiteral)) - (Import - (StringLiteral)) - (Import + (Import + (TextElement) + (TextElement) + ( (Identifier) - (StringLiteral))) + (TextElement))) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/grouped-import-declarations.parseB.txt b/test/fixtures/go/grouped-import-declarations.parseB.txt index b81a856a3..17726f254 100644 --- a/test/fixtures/go/grouped-import-declarations.parseB.txt +++ b/test/fixtures/go/grouped-import-declarations.parseB.txt @@ -1,14 +1,13 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - (StringLiteral)) - (Import - (StringLiteral)) - (Import + (Import + (TextElement) + (TextElement) + ( (Identifier) - (StringLiteral))) + (TextElement))) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/grouped-var-declarations.diffA-B.txt b/test/fixtures/go/grouped-var-declarations.diffA-B.txt index 3b93107f3..7e4dacc9f 100644 --- a/test/fixtures/go/grouped-var-declarations.diffA-B.txt +++ b/test/fixtures/go/grouped-var-declarations.diffA-B.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment + ( + (Assignment { (Identifier) ->(Identifier) } - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment { (Identifier) ->(Identifier) } - (Other "expression_list" - (NumberLiteral)))))) + (Integer))))) diff --git a/test/fixtures/go/grouped-var-declarations.diffB-A.txt b/test/fixtures/go/grouped-var-declarations.diffB-A.txt index 3b93107f3..7e4dacc9f 100644 --- a/test/fixtures/go/grouped-var-declarations.diffB-A.txt +++ b/test/fixtures/go/grouped-var-declarations.diffB-A.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment + ( + (Assignment { (Identifier) ->(Identifier) } - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment { (Identifier) ->(Identifier) } - (Other "expression_list" - (NumberLiteral)))))) + (Integer))))) diff --git a/test/fixtures/go/grouped-var-declarations.parseA.txt b/test/fixtures/go/grouped-var-declarations.parseA.txt index 3cb6def76..499d9392e 100644 --- a/test/fixtures/go/grouped-var-declarations.parseA.txt +++ b/test/fixtures/go/grouped-var-declarations.parseA.txt @@ -2,14 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Integer))))) diff --git a/test/fixtures/go/grouped-var-declarations.parseB.txt b/test/fixtures/go/grouped-var-declarations.parseB.txt index 3cb6def76..499d9392e 100644 --- a/test/fixtures/go/grouped-var-declarations.parseB.txt +++ b/test/fixtures/go/grouped-var-declarations.parseB.txt @@ -2,14 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Integer))))) diff --git a/test/fixtures/go/if-statements.diffA-B.txt b/test/fixtures/go/if-statements.diffA-B.txt index 22477d466..56c2a1b75 100644 --- a/test/fixtures/go/if-statements.diffA-B.txt +++ b/test/fixtures/go/if-statements.diffA-B.txt @@ -2,68 +2,68 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" + ( + (If + ( + (Call { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) }))) - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (ExpressionStatements - (FunctionCall - { (Identifier) - ->(Identifier) })) - (Other "else_clause" - (If - (RelationalOperator + ->(Identifier) } + (Empty))) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Assignment + { (Identifier) + ->(Identifier) } + (Call + (Identifier) + (Empty))) + (Identifier)) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Call + { (Identifier) + ->(Identifier) } + (Empty))) + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))) + (If + ( + (Assignment (Identifier) - (Other "<") - { (NumberLiteral) - ->(NumberLiteral) }) - (ExpressionStatements - (FunctionCall - { (Identifier) - ->(Identifier) })) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - { (Identifier) - ->(Identifier) })))))))) + { (Integer) + ->(Integer) }) + (LessThan + (Identifier) + (Integer))) + (Call + { (Identifier) + ->(Identifier) } + (Empty)) + (If + ( + (LessThan + (Identifier) + { (Integer) + ->(Integer) })) + (Call + { (Identifier) + ->(Identifier) } + (Empty)) + (Call + { (Identifier) + ->(Identifier) } + (Empty))))))) diff --git a/test/fixtures/go/if-statements.diffB-A.txt b/test/fixtures/go/if-statements.diffB-A.txt index 22477d466..56c2a1b75 100644 --- a/test/fixtures/go/if-statements.diffB-A.txt +++ b/test/fixtures/go/if-statements.diffB-A.txt @@ -2,68 +2,68 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" + ( + (If + ( + (Call { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) }))) - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (ExpressionStatements - (FunctionCall - { (Identifier) - ->(Identifier) })) - (Other "else_clause" - (If - (RelationalOperator + ->(Identifier) } + (Empty))) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Assignment + { (Identifier) + ->(Identifier) } + (Call + (Identifier) + (Empty))) + (Identifier)) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Call + { (Identifier) + ->(Identifier) } + (Empty))) + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))) + (If + ( + (Assignment (Identifier) - (Other "<") - { (NumberLiteral) - ->(NumberLiteral) }) - (ExpressionStatements - (FunctionCall - { (Identifier) - ->(Identifier) })) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - { (Identifier) - ->(Identifier) })))))))) + { (Integer) + ->(Integer) }) + (LessThan + (Identifier) + (Integer))) + (Call + { (Identifier) + ->(Identifier) } + (Empty)) + (If + ( + (LessThan + (Identifier) + { (Integer) + ->(Integer) })) + (Call + { (Identifier) + ->(Identifier) } + (Empty)) + (Call + { (Identifier) + ->(Identifier) } + (Empty))))))) diff --git a/test/fixtures/go/if-statements.parseA.txt b/test/fixtures/go/if-statements.parseA.txt index 5820b7e94..5c54cbfcc 100644 --- a/test/fixtures/go/if-statements.parseA.txt +++ b/test/fixtures/go/if-statements.parseA.txt @@ -2,60 +2,60 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral)))) - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (If - (RelationalOperator + ( + (If + ( + (Call (Identifier) - (Other "<") - (NumberLiteral)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))))))) + (Empty))) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Assignment + (Identifier) + (Call + (Identifier) + (Empty))) + (Identifier)) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Call + (Identifier) + (Empty))) + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))) + (If + ( + (Assignment + (Identifier) + (Integer)) + (LessThan + (Identifier) + (Integer))) + (Call + (Identifier) + (Empty)) + (If + ( + (LessThan + (Identifier) + (Integer))) + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))))))) diff --git a/test/fixtures/go/if-statements.parseB.txt b/test/fixtures/go/if-statements.parseB.txt index 5820b7e94..5c54cbfcc 100644 --- a/test/fixtures/go/if-statements.parseB.txt +++ b/test/fixtures/go/if-statements.parseB.txt @@ -2,60 +2,60 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (NumberLiteral)))) - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (If - (RelationalOperator + ( + (If + ( + (Call (Identifier) - (Other "<") - (NumberLiteral)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))))))) + (Empty))) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Assignment + (Identifier) + (Call + (Identifier) + (Empty))) + (Identifier)) + (Call + (Identifier) + (Empty)) + (Empty)) + (If + ( + (Call + (Identifier) + (Empty))) + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))) + (If + ( + (Assignment + (Identifier) + (Integer)) + (LessThan + (Identifier) + (Integer))) + (Call + (Identifier) + (Empty)) + (If + ( + (LessThan + (Identifier) + (Integer))) + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))))))) diff --git a/test/fixtures/go/imaginary-literals.diffA-B.txt b/test/fixtures/go/imaginary-literals.diffA-B.txt index 198b0072b..c99e29f9f 100644 --- a/test/fixtures/go/imaginary-literals.diffA-B.txt +++ b/test/fixtures/go/imaginary-literals.diffA-B.txt @@ -2,16 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (Other "imaginary_literal") - ->(Other "imaginary_literal") })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (Other "imaginary_literal") - ->(Other "imaginary_literal") }))))) + (Error))))) diff --git a/test/fixtures/go/imaginary-literals.diffB-A.txt b/test/fixtures/go/imaginary-literals.diffB-A.txt index 198b0072b..c99e29f9f 100644 --- a/test/fixtures/go/imaginary-literals.diffB-A.txt +++ b/test/fixtures/go/imaginary-literals.diffB-A.txt @@ -2,16 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (Other "imaginary_literal") - ->(Other "imaginary_literal") })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (Other "imaginary_literal") - ->(Other "imaginary_literal") }))))) + (Error))))) diff --git a/test/fixtures/go/imaginary-literals.parseA.txt b/test/fixtures/go/imaginary-literals.parseA.txt index dc9d117d2..c99e29f9f 100644 --- a/test/fixtures/go/imaginary-literals.parseA.txt +++ b/test/fixtures/go/imaginary-literals.parseA.txt @@ -2,14 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "imaginary_literal"))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (Other "imaginary_literal")))))) + (Error))))) diff --git a/test/fixtures/go/imaginary-literals.parseB.txt b/test/fixtures/go/imaginary-literals.parseB.txt index dc9d117d2..c99e29f9f 100644 --- a/test/fixtures/go/imaginary-literals.parseB.txt +++ b/test/fixtures/go/imaginary-literals.parseB.txt @@ -2,14 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "imaginary_literal"))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (Other "imaginary_literal")))))) + (Error))))) diff --git a/test/fixtures/go/increment-decrement-statements.diffA-B.txt b/test/fixtures/go/increment-decrement-statements.diffA-B.txt index 53f3831e1..31b6de303 100644 --- a/test/fixtures/go/increment-decrement-statements.diffA-B.txt +++ b/test/fixtures/go/increment-decrement-statements.diffA-B.txt @@ -2,9 +2,13 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - { (IncrementStatement) - ->(IncrementStatement) } - {+(IncrementStatement)+} - {-(DecrementStatement)-})) + ( + (PostIncrement + { (Identifier) + ->(Identifier) }) + {+(PostIncrement + {+(Identifier)+})+} + {-(PostDecrement + {-(Identifier)-})-}))) diff --git a/test/fixtures/go/increment-decrement-statements.diffB-A.txt b/test/fixtures/go/increment-decrement-statements.diffB-A.txt index da1f76e5a..d2ba2f5dc 100644 --- a/test/fixtures/go/increment-decrement-statements.diffB-A.txt +++ b/test/fixtures/go/increment-decrement-statements.diffB-A.txt @@ -2,9 +2,13 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - { (IncrementStatement) - ->(IncrementStatement) } - {+(DecrementStatement)+} - {-(IncrementStatement)-})) + ( + (PostIncrement + { (Identifier) + ->(Identifier) }) + {+(PostDecrement + {+(Identifier)+})+} + {-(PostIncrement + {-(Identifier)-})-}))) diff --git a/test/fixtures/go/increment-decrement-statements.parseA.txt b/test/fixtures/go/increment-decrement-statements.parseA.txt index bb985193a..466d97a40 100644 --- a/test/fixtures/go/increment-decrement-statements.parseA.txt +++ b/test/fixtures/go/increment-decrement-statements.parseA.txt @@ -2,7 +2,10 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (IncrementStatement) - (DecrementStatement))) + ( + (PostIncrement + (Identifier)) + (PostDecrement + (Identifier))))) diff --git a/test/fixtures/go/increment-decrement-statements.parseB.txt b/test/fixtures/go/increment-decrement-statements.parseB.txt index 2ca019af3..d41ba4f7b 100644 --- a/test/fixtures/go/increment-decrement-statements.parseB.txt +++ b/test/fixtures/go/increment-decrement-statements.parseB.txt @@ -2,7 +2,10 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (IncrementStatement) - (IncrementStatement))) + ( + (PostIncrement + (Identifier)) + (PostIncrement + (Identifier))))) diff --git a/test/fixtures/go/indexing-expressions.diffA-B.txt b/test/fixtures/go/indexing-expressions.diffA-B.txt index b87330abf..e31b62159 100644 --- a/test/fixtures/go/indexing-expressions.diffA-B.txt +++ b/test/fixtures/go/indexing-expressions.diffA-B.txt @@ -1,36 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - {+(Slice - {+(Identifier)+} - {+(NumberLiteral)+})+} - {+(Slice - {+(Identifier)+} - {+(NumberLiteral)+})+} - {+(Slice - {+(Identifier)+} - {+(NumberLiteral)+})+} - {-(IndexExpression - {-(Identifier)-} - {-(NumberLiteral)-})-} - {-(Slice - {-(Identifier)-})-} - {-(Slice - {-(Identifier)-} - {-(NumberLiteral)-})-} - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral) - (NumberLiteral)))) + (Error)) diff --git a/test/fixtures/go/indexing-expressions.diffB-A.txt b/test/fixtures/go/indexing-expressions.diffB-A.txt index 2762f0631..e31b62159 100644 --- a/test/fixtures/go/indexing-expressions.diffB-A.txt +++ b/test/fixtures/go/indexing-expressions.diffB-A.txt @@ -1,35 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - {+(IndexExpression - {+(Identifier)+} - {+(NumberLiteral)+})+} - {+(Slice - {+(Identifier)+})+} - (Slice - { (Identifier) - ->(Identifier) } - { (NumberLiteral) - ->(NumberLiteral) }) - {-(Slice - {-(Identifier)-} - {-(NumberLiteral)-})-} - {-(Slice - {-(Identifier)-} - {-(NumberLiteral)-})-} - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral) - (NumberLiteral)))) + (Error)) diff --git a/test/fixtures/go/indexing-expressions.parseA.txt b/test/fixtures/go/indexing-expressions.parseA.txt index 2fc2ce2b4..e31b62159 100644 --- a/test/fixtures/go/indexing-expressions.parseA.txt +++ b/test/fixtures/go/indexing-expressions.parseA.txt @@ -1,27 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (IndexExpression - (Identifier) - (NumberLiteral)) - (Slice - (Identifier)) - (Slice - (Identifier) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral) - (NumberLiteral)))) + (Error)) diff --git a/test/fixtures/go/indexing-expressions.parseB.txt b/test/fixtures/go/indexing-expressions.parseB.txt index 6e461cec6..e31b62159 100644 --- a/test/fixtures/go/indexing-expressions.parseB.txt +++ b/test/fixtures/go/indexing-expressions.parseB.txt @@ -1,28 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Slice - (Identifier) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral)) - (Slice - (Identifier) - (NumberLiteral) - (NumberLiteral) - (NumberLiteral)))) + (Error)) diff --git a/test/fixtures/go/int-literals.diffA-B.txt b/test/fixtures/go/int-literals.diffA-B.txt index a4762e6a2..9be0c4c0a 100644 --- a/test/fixtures/go/int-literals.diffA-B.txt +++ b/test/fixtures/go/int-literals.diffA-B.txt @@ -2,21 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) })) - (VarAssignment + { (Integer) + ->(Integer) }) + (Assignment (Identifier) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) })) - (VarAssignment + { (Integer) + ->(Integer) }) + (Assignment (Identifier) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) }))))) + { (Integer) + ->(Integer) })))) diff --git a/test/fixtures/go/int-literals.diffB-A.txt b/test/fixtures/go/int-literals.diffB-A.txt index a4762e6a2..9be0c4c0a 100644 --- a/test/fixtures/go/int-literals.diffB-A.txt +++ b/test/fixtures/go/int-literals.diffB-A.txt @@ -2,21 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) })) - (VarAssignment + { (Integer) + ->(Integer) }) + (Assignment (Identifier) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) })) - (VarAssignment + { (Integer) + ->(Integer) }) + (Assignment (Identifier) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) }))))) + { (Integer) + ->(Integer) })))) diff --git a/test/fixtures/go/int-literals.parseA.txt b/test/fixtures/go/int-literals.parseA.txt index 0654f3cef..9341f02cf 100644 --- a/test/fixtures/go/int-literals.parseA.txt +++ b/test/fixtures/go/int-literals.parseA.txt @@ -2,18 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Integer))))) diff --git a/test/fixtures/go/int-literals.parseB.txt b/test/fixtures/go/int-literals.parseB.txt index 0654f3cef..9341f02cf 100644 --- a/test/fixtures/go/int-literals.parseB.txt +++ b/test/fixtures/go/int-literals.parseB.txt @@ -2,18 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral))) - (VarAssignment + (Integer)) + (Assignment (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Integer))))) diff --git a/test/fixtures/go/interface-types.diffA-B.txt b/test/fixtures/go/interface-types.diffA-B.txt index e0ca04c3a..8e93f0dfe 100644 --- a/test/fixtures/go/interface-types.diffA-B.txt +++ b/test/fixtures/go/interface-types.diffA-B.txt @@ -2,30 +2,21 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (Other "interface_type"))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (Other "interface_type" - (QualifiedType)))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (Other "interface_type" - (Identifier) - (QualifiedType) - (Other "method_spec" - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier))))))) + ( + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Interface))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Error))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Error)))))) diff --git a/test/fixtures/go/interface-types.diffB-A.txt b/test/fixtures/go/interface-types.diffB-A.txt index e0ca04c3a..8e93f0dfe 100644 --- a/test/fixtures/go/interface-types.diffB-A.txt +++ b/test/fixtures/go/interface-types.diffB-A.txt @@ -2,30 +2,21 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (Other "interface_type"))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (Other "interface_type" - (QualifiedType)))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (Other "interface_type" - (Identifier) - (QualifiedType) - (Other "method_spec" - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier))))))) + ( + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Interface))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Error))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Error)))))) diff --git a/test/fixtures/go/interface-types.parseA.txt b/test/fixtures/go/interface-types.parseA.txt index 5a89eb9cc..484e46c2c 100644 --- a/test/fixtures/go/interface-types.parseA.txt +++ b/test/fixtures/go/interface-types.parseA.txt @@ -2,27 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Other "interface_type"))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Other "interface_type" - (QualifiedType)))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Other "interface_type" + ( + ( + (Annotation (Identifier) - (QualifiedType) - (Other "method_spec" - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier))))))) + (Interface))) + ( + (Annotation + (Identifier) + (Error))) + ( + (Annotation + (Identifier) + (Error)))))) diff --git a/test/fixtures/go/interface-types.parseB.txt b/test/fixtures/go/interface-types.parseB.txt index 5a89eb9cc..484e46c2c 100644 --- a/test/fixtures/go/interface-types.parseB.txt +++ b/test/fixtures/go/interface-types.parseB.txt @@ -2,27 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Other "interface_type"))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Other "interface_type" - (QualifiedType)))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Other "interface_type" + ( + ( + (Annotation (Identifier) - (QualifiedType) - (Other "method_spec" - (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier))))))) + (Interface))) + ( + (Annotation + (Identifier) + (Error))) + ( + (Annotation + (Identifier) + (Error)))))) diff --git a/test/fixtures/go/label-statements.diffA-B.txt b/test/fixtures/go/label-statements.diffA-B.txt index 6269f9f7e..3be354ac0 100644 --- a/test/fixtures/go/label-statements.diffA-B.txt +++ b/test/fixtures/go/label-statements.diffA-B.txt @@ -2,9 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (ExpressionStatements - (Other "label_statement" - { (Identifier) - ->(Identifier) })))) + (Error))) diff --git a/test/fixtures/go/label-statements.diffB-A.txt b/test/fixtures/go/label-statements.diffB-A.txt index 6269f9f7e..3be354ac0 100644 --- a/test/fixtures/go/label-statements.diffB-A.txt +++ b/test/fixtures/go/label-statements.diffB-A.txt @@ -2,9 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (ExpressionStatements - (Other "label_statement" - { (Identifier) - ->(Identifier) })))) + (Error))) diff --git a/test/fixtures/go/label-statements.parseA.txt b/test/fixtures/go/label-statements.parseA.txt index c133fa043..3be354ac0 100644 --- a/test/fixtures/go/label-statements.parseA.txt +++ b/test/fixtures/go/label-statements.parseA.txt @@ -2,8 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (ExpressionStatements - (Other "label_statement" - (Identifier))))) + (Error))) diff --git a/test/fixtures/go/label-statements.parseB.txt b/test/fixtures/go/label-statements.parseB.txt index c133fa043..3be354ac0 100644 --- a/test/fixtures/go/label-statements.parseB.txt +++ b/test/fixtures/go/label-statements.parseB.txt @@ -2,8 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (ExpressionStatements - (Other "label_statement" - (Identifier))))) + (Error))) diff --git a/test/fixtures/go/map-literals.diffA-B.txt b/test/fixtures/go/map-literals.diffA-B.txt index 4ddf5755e..1d79927ab 100644 --- a/test/fixtures/go/map-literals.diffA-B.txt +++ b/test/fixtures/go/map-literals.diffA-B.txt @@ -2,24 +2,23 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (DictionaryTy - (Identifier) - { (Identifier) - ->(Identifier) }) - (Pair - { (StringLiteral) - ->(StringLiteral) } - { (StringLiteral) - ->(StringLiteral) }) - (Pair - { (StringLiteral) - ->(StringLiteral) } - { (StringLiteral) - ->(StringLiteral) }))))))) + (Assignment + (Identifier) + (Composite + (Map + (Identifier) + { (Identifier) + ->(Identifier) }) + ( + (KeyValue + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) }) + (KeyValue + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) })))))) diff --git a/test/fixtures/go/map-literals.diffB-A.txt b/test/fixtures/go/map-literals.diffB-A.txt index 4ddf5755e..1d79927ab 100644 --- a/test/fixtures/go/map-literals.diffB-A.txt +++ b/test/fixtures/go/map-literals.diffB-A.txt @@ -2,24 +2,23 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (DictionaryTy - (Identifier) - { (Identifier) - ->(Identifier) }) - (Pair - { (StringLiteral) - ->(StringLiteral) } - { (StringLiteral) - ->(StringLiteral) }) - (Pair - { (StringLiteral) - ->(StringLiteral) } - { (StringLiteral) - ->(StringLiteral) }))))))) + (Assignment + (Identifier) + (Composite + (Map + (Identifier) + { (Identifier) + ->(Identifier) }) + ( + (KeyValue + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) }) + (KeyValue + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) })))))) diff --git a/test/fixtures/go/map-literals.parseA.txt b/test/fixtures/go/map-literals.parseA.txt index 6eaa57177..db74831d5 100644 --- a/test/fixtures/go/map-literals.parseA.txt +++ b/test/fixtures/go/map-literals.parseA.txt @@ -2,19 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (DictionaryTy - (Identifier) - (Identifier)) - (Pair - (StringLiteral) - (StringLiteral)) - (Pair - (StringLiteral) - (StringLiteral)))))))) + (Assignment + (Identifier) + (Composite + (Map + (Identifier) + (Identifier)) + ( + (KeyValue + (TextElement) + (TextElement)) + (KeyValue + (TextElement) + (TextElement))))))) diff --git a/test/fixtures/go/map-literals.parseB.txt b/test/fixtures/go/map-literals.parseB.txt index 6eaa57177..db74831d5 100644 --- a/test/fixtures/go/map-literals.parseB.txt +++ b/test/fixtures/go/map-literals.parseB.txt @@ -2,19 +2,18 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (Other "composite_literal" - (DictionaryTy - (Identifier) - (Identifier)) - (Pair - (StringLiteral) - (StringLiteral)) - (Pair - (StringLiteral) - (StringLiteral)))))))) + (Assignment + (Identifier) + (Composite + (Map + (Identifier) + (Identifier)) + ( + (KeyValue + (TextElement) + (TextElement)) + (KeyValue + (TextElement) + (TextElement))))))) diff --git a/test/fixtures/go/map-types.diffA-B.txt b/test/fixtures/go/map-types.diffA-B.txt index 7eaefe92b..ebf22eaf5 100644 --- a/test/fixtures/go/map-types.diffA-B.txt +++ b/test/fixtures/go/map-types.diffA-B.txt @@ -2,12 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (DictionaryTy + (Map { (Identifier) ->(Identifier) } (Identifier)))))) diff --git a/test/fixtures/go/map-types.diffB-A.txt b/test/fixtures/go/map-types.diffB-A.txt index 7eaefe92b..ebf22eaf5 100644 --- a/test/fixtures/go/map-types.diffB-A.txt +++ b/test/fixtures/go/map-types.diffB-A.txt @@ -2,12 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (DictionaryTy + (Map { (Identifier) ->(Identifier) } (Identifier)))))) diff --git a/test/fixtures/go/map-types.parseA.txt b/test/fixtures/go/map-types.parseA.txt index a92ce5f62..52d5c4a4c 100644 --- a/test/fixtures/go/map-types.parseA.txt +++ b/test/fixtures/go/map-types.parseA.txt @@ -2,11 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (DictionaryTy + (Map (Identifier) (Identifier)))))) diff --git a/test/fixtures/go/map-types.parseB.txt b/test/fixtures/go/map-types.parseB.txt index a92ce5f62..52d5c4a4c 100644 --- a/test/fixtures/go/map-types.parseB.txt +++ b/test/fixtures/go/map-types.parseB.txt @@ -2,11 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (DictionaryTy + (Map (Identifier) (Identifier)))))) diff --git a/test/fixtures/go/method-declarations.diffA-B.txt b/test/fixtures/go/method-declarations.diffA-B.txt index 9b8359503..b0205bbc0 100644 --- a/test/fixtures/go/method-declarations.diffA-B.txt +++ b/test/fixtures/go/method-declarations.diffA-B.txt @@ -2,18 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Method (Identifier) - (Args - (ParameterDecl - { (Identifier) - ->(Identifier) } - (Identifier))) - (Args - (ParameterDecl - { (Identifier) - ->(Identifier) } - (Identifier))) - (Identifier))) + ( + (Identifier) + { (Identifier) + ->(Identifier) }) + (Identifier) + (Identifier) + { (Identifier) + ->(Identifier) } + ([]))) diff --git a/test/fixtures/go/method-declarations.diffB-A.txt b/test/fixtures/go/method-declarations.diffB-A.txt index 9b8359503..b0205bbc0 100644 --- a/test/fixtures/go/method-declarations.diffB-A.txt +++ b/test/fixtures/go/method-declarations.diffB-A.txt @@ -2,18 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Method (Identifier) - (Args - (ParameterDecl - { (Identifier) - ->(Identifier) } - (Identifier))) - (Args - (ParameterDecl - { (Identifier) - ->(Identifier) } - (Identifier))) - (Identifier))) + ( + (Identifier) + { (Identifier) + ->(Identifier) }) + (Identifier) + (Identifier) + { (Identifier) + ->(Identifier) } + ([]))) diff --git a/test/fixtures/go/method-declarations.parseA.txt b/test/fixtures/go/method-declarations.parseA.txt index 674f3c8f6..44733dd8e 100644 --- a/test/fixtures/go/method-declarations.parseA.txt +++ b/test/fixtures/go/method-declarations.parseA.txt @@ -2,16 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Method (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier))) + ( + (Identifier) + (Identifier)) + (Identifier) + (Identifier) + (Identifier) + ([]))) diff --git a/test/fixtures/go/method-declarations.parseB.txt b/test/fixtures/go/method-declarations.parseB.txt index 674f3c8f6..44733dd8e 100644 --- a/test/fixtures/go/method-declarations.parseB.txt +++ b/test/fixtures/go/method-declarations.parseB.txt @@ -2,16 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Method (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Args - (ParameterDecl - (Identifier) - (Identifier))) - (Identifier))) + ( + (Identifier) + (Identifier)) + (Identifier) + (Identifier) + (Identifier) + ([]))) diff --git a/test/fixtures/go/modifying-struct-fields.diffA-B.txt b/test/fixtures/go/modifying-struct-fields.diffA-B.txt index e44a41534..44a0d30d4 100644 --- a/test/fixtures/go/modifying-struct-fields.diffA-B.txt +++ b/test/fixtures/go/modifying-struct-fields.diffA-B.txt @@ -2,19 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" - (Identifier) - (Pair + (Assignment + (Identifier) + (Reference + (Composite + (Identifier) + ( + (KeyValue { (Identifier) ->(Identifier) } { (Identifier) - ->(FunctionCall - {+(Identifier)+} - {+(QualifiedType)+}) }))))))) + ->(Error) }))))))) diff --git a/test/fixtures/go/modifying-struct-fields.diffB-A.txt b/test/fixtures/go/modifying-struct-fields.diffB-A.txt index 1789d00a8..3269dc719 100644 --- a/test/fixtures/go/modifying-struct-fields.diffB-A.txt +++ b/test/fixtures/go/modifying-struct-fields.diffB-A.txt @@ -2,19 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" - (Identifier) - (Pair + (Assignment + (Identifier) + (Reference + (Composite + (Identifier) + ( + (KeyValue { (Identifier) ->(Identifier) } - { (FunctionCall - {-(Identifier)-} - {-(QualifiedType)-}) + { (Error) ->(Identifier) }))))))) diff --git a/test/fixtures/go/modifying-struct-fields.parseA.txt b/test/fixtures/go/modifying-struct-fields.parseA.txt index 2ded440b0..33337fbe0 100644 --- a/test/fixtures/go/modifying-struct-fields.parseA.txt +++ b/test/fixtures/go/modifying-struct-fields.parseA.txt @@ -2,15 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" - (Identifier) - (Pair + (Assignment + (Identifier) + (Reference + (Composite + (Identifier) + ( + (KeyValue (Identifier) (Identifier)))))))) diff --git a/test/fixtures/go/modifying-struct-fields.parseB.txt b/test/fixtures/go/modifying-struct-fields.parseB.txt index 147c1a047..73319fa12 100644 --- a/test/fixtures/go/modifying-struct-fields.parseB.txt +++ b/test/fixtures/go/modifying-struct-fields.parseB.txt @@ -2,17 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (Operator - (Other "composite_literal" - (Identifier) - (Pair + (Assignment + (Identifier) + (Reference + (Composite + (Identifier) + ( + (KeyValue (Identifier) - (FunctionCall - (Identifier) - (QualifiedType))))))))) + (Error)))))))) diff --git a/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt b/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt index 5fba968be..78d829d41 100644 --- a/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt +++ b/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt @@ -2,18 +2,20 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args - (ParameterDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (ParameterDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + ([]))) diff --git a/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt b/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt index 5fba968be..78d829d41 100644 --- a/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt +++ b/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt @@ -2,18 +2,20 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args - (ParameterDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (ParameterDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + ([]))) diff --git a/test/fixtures/go/parameter-declarations-with-types.parseA.txt b/test/fixtures/go/parameter-declarations-with-types.parseA.txt index 9b11d5037..36b285bc7 100644 --- a/test/fixtures/go/parameter-declarations-with-types.parseA.txt +++ b/test/fixtures/go/parameter-declarations-with-types.parseA.txt @@ -2,14 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))) + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier)) + ([]))) diff --git a/test/fixtures/go/parameter-declarations-with-types.parseB.txt b/test/fixtures/go/parameter-declarations-with-types.parseB.txt index 9b11d5037..36b285bc7 100644 --- a/test/fixtures/go/parameter-declarations-with-types.parseB.txt +++ b/test/fixtures/go/parameter-declarations-with-types.parseB.txt @@ -2,14 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args - (ParameterDecl - (Identifier) - (Identifier)) - (ParameterDecl - (Identifier) - (Identifier))))) + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier)) + ([]))) diff --git a/test/fixtures/go/pointer-types.diffA-B.txt b/test/fixtures/go/pointer-types.diffA-B.txt index d6d0d2174..347c199fa 100644 --- a/test/fixtures/go/pointer-types.diffA-B.txt +++ b/test/fixtures/go/pointer-types.diffA-B.txt @@ -2,17 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (PointerTy + (Pointer { (Identifier) ->(Identifier) })) - (TypeDecl + (Annotation (Identifier) - (PointerTy - (PointerTy + (Pointer + (Pointer { (Identifier) ->(Identifier) })))))) diff --git a/test/fixtures/go/pointer-types.diffB-A.txt b/test/fixtures/go/pointer-types.diffB-A.txt index d6d0d2174..347c199fa 100644 --- a/test/fixtures/go/pointer-types.diffB-A.txt +++ b/test/fixtures/go/pointer-types.diffB-A.txt @@ -2,17 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (PointerTy + (Pointer { (Identifier) ->(Identifier) })) - (TypeDecl + (Annotation (Identifier) - (PointerTy - (PointerTy + (Pointer + (Pointer { (Identifier) ->(Identifier) })))))) diff --git a/test/fixtures/go/pointer-types.parseA.txt b/test/fixtures/go/pointer-types.parseA.txt index 29dc34e06..c981ad2f1 100644 --- a/test/fixtures/go/pointer-types.parseA.txt +++ b/test/fixtures/go/pointer-types.parseA.txt @@ -2,15 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (PointerTy + (Pointer (Identifier))) - (TypeDecl + (Annotation (Identifier) - (PointerTy - (PointerTy + (Pointer + (Pointer (Identifier))))))) diff --git a/test/fixtures/go/pointer-types.parseB.txt b/test/fixtures/go/pointer-types.parseB.txt index 29dc34e06..c981ad2f1 100644 --- a/test/fixtures/go/pointer-types.parseB.txt +++ b/test/fixtures/go/pointer-types.parseB.txt @@ -2,15 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (PointerTy + (Pointer (Identifier))) - (TypeDecl + (Annotation (Identifier) - (PointerTy - (PointerTy + (Pointer + (Pointer (Identifier))))))) diff --git a/test/fixtures/go/qualified-types.diffA-B.txt b/test/fixtures/go/qualified-types.diffA-B.txt index f91f9a9c2..68a12a4c3 100644 --- a/test/fixtures/go/qualified-types.diffA-B.txt +++ b/test/fixtures/go/qualified-types.diffA-B.txt @@ -2,11 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation { (Identifier) ->(Identifier) } - { (QualifiedType) - ->(QualifiedType) })))) + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))))) diff --git a/test/fixtures/go/qualified-types.diffB-A.txt b/test/fixtures/go/qualified-types.diffB-A.txt index f91f9a9c2..68a12a4c3 100644 --- a/test/fixtures/go/qualified-types.diffB-A.txt +++ b/test/fixtures/go/qualified-types.diffB-A.txt @@ -2,11 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation { (Identifier) ->(Identifier) } - { (QualifiedType) - ->(QualifiedType) })))) + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))))) diff --git a/test/fixtures/go/qualified-types.parseA.txt b/test/fixtures/go/qualified-types.parseA.txt index d305a4326..67f7f2eaf 100644 --- a/test/fixtures/go/qualified-types.parseA.txt +++ b/test/fixtures/go/qualified-types.parseA.txt @@ -2,9 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (QualifiedType))))) + (MemberAccess + (Identifier) + (Identifier)))))) diff --git a/test/fixtures/go/qualified-types.parseB.txt b/test/fixtures/go/qualified-types.parseB.txt index d305a4326..67f7f2eaf 100644 --- a/test/fixtures/go/qualified-types.parseB.txt +++ b/test/fixtures/go/qualified-types.parseB.txt @@ -2,9 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (QualifiedType))))) + (MemberAccess + (Identifier) + (Identifier)))))) diff --git a/test/fixtures/go/rune-literals.diffA-B.txt b/test/fixtures/go/rune-literals.diffA-B.txt index 3fe88e3a4..df5b35cca 100644 --- a/test/fixtures/go/rune-literals.diffA-B.txt +++ b/test/fixtures/go/rune-literals.diffA-B.txt @@ -1,34 +1,22 @@ (Program (Module (Identifier)) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })))) + (Error)))) diff --git a/test/fixtures/go/rune-literals.diffB-A.txt b/test/fixtures/go/rune-literals.diffB-A.txt index 3fe88e3a4..df5b35cca 100644 --- a/test/fixtures/go/rune-literals.diffB-A.txt +++ b/test/fixtures/go/rune-literals.diffB-A.txt @@ -1,34 +1,22 @@ (Program (Module (Identifier)) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - { (RuneLiteral) - ->(RuneLiteral) })))) + (Error)))) diff --git a/test/fixtures/go/rune-literals.parseA.txt b/test/fixtures/go/rune-literals.parseA.txt index 74fcad32e..df5b35cca 100644 --- a/test/fixtures/go/rune-literals.parseA.txt +++ b/test/fixtures/go/rune-literals.parseA.txt @@ -1,28 +1,22 @@ (Program (Module (Identifier)) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))))) + (Error)))) diff --git a/test/fixtures/go/rune-literals.parseB.txt b/test/fixtures/go/rune-literals.parseB.txt index 74fcad32e..df5b35cca 100644 --- a/test/fixtures/go/rune-literals.parseB.txt +++ b/test/fixtures/go/rune-literals.parseB.txt @@ -1,28 +1,22 @@ (Program (Module (Identifier)) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))) - (VarAssignment + (Error)) + (Assignment (Identifier) - (Other "expression_list" - (RuneLiteral))))) + (Error)))) diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index f182d5651..e31b62159 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -1,39 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Select - (Case - (Other "receive_statement" - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - { (Identifier) - ->(Identifier) } - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - { (NumberLiteral) - ->(NumberLiteral) })))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case) - (Return)))) + (Error)) diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index f182d5651..e31b62159 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -1,39 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Select - (Case - (Other "receive_statement" - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - { (Identifier) - ->(Identifier) } - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - { (NumberLiteral) - ->(NumberLiteral) })))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case) - (Return)))) + (Error)) diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index c7ac79850..e31b62159 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -1,36 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Select - (Case - (Other "receive_statement" - (Other "expression_list" - (Identifier)) - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - (Identifier) - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (NumberLiteral))))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case) - (Return)))) + (Error)) diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index c7ac79850..e31b62159 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -1,36 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Select - (Case - (Other "receive_statement" - (Other "expression_list" - (Identifier)) - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - (Identifier) - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (NumberLiteral))))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case) - (Return)))) + (Error)) diff --git a/test/fixtures/go/selector-expressions.diffA-B.txt b/test/fixtures/go/selector-expressions.diffA-B.txt index f19c5c073..3be354ac0 100644 --- a/test/fixtures/go/selector-expressions.diffA-B.txt +++ b/test/fixtures/go/selector-expressions.diffA-B.txt @@ -2,14 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (SubscriptAccess - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) })))) + (Error))) diff --git a/test/fixtures/go/selector-expressions.diffB-A.txt b/test/fixtures/go/selector-expressions.diffB-A.txt index f19c5c073..3be354ac0 100644 --- a/test/fixtures/go/selector-expressions.diffB-A.txt +++ b/test/fixtures/go/selector-expressions.diffB-A.txt @@ -2,14 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (SubscriptAccess - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) })))) + (Error))) diff --git a/test/fixtures/go/selector-expressions.parseA.txt b/test/fixtures/go/selector-expressions.parseA.txt index 470aee857..3be354ac0 100644 --- a/test/fixtures/go/selector-expressions.parseA.txt +++ b/test/fixtures/go/selector-expressions.parseA.txt @@ -2,11 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (SubscriptAccess - (SubscriptAccess - (Identifier) - (Identifier)) - (Identifier))))) + (Error))) diff --git a/test/fixtures/go/selector-expressions.parseB.txt b/test/fixtures/go/selector-expressions.parseB.txt index 470aee857..3be354ac0 100644 --- a/test/fixtures/go/selector-expressions.parseB.txt +++ b/test/fixtures/go/selector-expressions.parseB.txt @@ -2,11 +2,6 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (SubscriptAccess - (SubscriptAccess - (Identifier) - (Identifier)) - (Identifier))))) + (Error))) diff --git a/test/fixtures/go/send-statements.diffA-B.txt b/test/fixtures/go/send-statements.diffA-B.txt index caa409444..e31b62159 100644 --- a/test/fixtures/go/send-statements.diffA-B.txt +++ b/test/fixtures/go/send-statements.diffA-B.txt @@ -1,11 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Send - { (Identifier) - ->(Identifier) } - { (NumberLiteral) - ->(NumberLiteral) }))) + (Error)) diff --git a/test/fixtures/go/send-statements.diffB-A.txt b/test/fixtures/go/send-statements.diffB-A.txt index caa409444..e31b62159 100644 --- a/test/fixtures/go/send-statements.diffB-A.txt +++ b/test/fixtures/go/send-statements.diffB-A.txt @@ -1,11 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Send - { (Identifier) - ->(Identifier) } - { (NumberLiteral) - ->(NumberLiteral) }))) + (Error)) diff --git a/test/fixtures/go/send-statements.parseA.txt b/test/fixtures/go/send-statements.parseA.txt index 212e1c120..e31b62159 100644 --- a/test/fixtures/go/send-statements.parseA.txt +++ b/test/fixtures/go/send-statements.parseA.txt @@ -1,9 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Send - (Identifier) - (NumberLiteral)))) + (Error)) diff --git a/test/fixtures/go/send-statements.parseB.txt b/test/fixtures/go/send-statements.parseB.txt index 212e1c120..e31b62159 100644 --- a/test/fixtures/go/send-statements.parseB.txt +++ b/test/fixtures/go/send-statements.parseB.txt @@ -1,9 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Send - (Identifier) - (NumberLiteral)))) + (Error)) diff --git a/test/fixtures/go/short-var-declarations.diffA-B.txt b/test/fixtures/go/short-var-declarations.diffA-B.txt index 90652df76..b5539f688 100644 --- a/test/fixtures/go/short-var-declarations.diffA-B.txt +++ b/test/fixtures/go/short-var-declarations.diffA-B.txt @@ -2,16 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" + (Assignment + ( { (Identifier) ->(Identifier) } { (Identifier) ->(Identifier) }) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) })))) + ( + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) })))) diff --git a/test/fixtures/go/short-var-declarations.diffB-A.txt b/test/fixtures/go/short-var-declarations.diffB-A.txt index 90652df76..b5539f688 100644 --- a/test/fixtures/go/short-var-declarations.diffB-A.txt +++ b/test/fixtures/go/short-var-declarations.diffB-A.txt @@ -2,16 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" + (Assignment + ( { (Identifier) ->(Identifier) } { (Identifier) ->(Identifier) }) - (Other "expression_list" - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) })))) + ( + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) })))) diff --git a/test/fixtures/go/short-var-declarations.parseA.txt b/test/fixtures/go/short-var-declarations.parseA.txt index 4a11c1e45..bfcfcf674 100644 --- a/test/fixtures/go/short-var-declarations.parseA.txt +++ b/test/fixtures/go/short-var-declarations.parseA.txt @@ -2,12 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" + (Assignment + ( (Identifier) (Identifier)) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))))) + ( + (Integer) + (Integer))))) diff --git a/test/fixtures/go/short-var-declarations.parseB.txt b/test/fixtures/go/short-var-declarations.parseB.txt index 4a11c1e45..bfcfcf674 100644 --- a/test/fixtures/go/short-var-declarations.parseB.txt +++ b/test/fixtures/go/short-var-declarations.parseB.txt @@ -2,12 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (VarDecl - (Other "expression_list" + (Assignment + ( (Identifier) (Identifier)) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral))))) + ( + (Integer) + (Integer))))) diff --git a/test/fixtures/go/single-import-declarations.diffA-B.txt b/test/fixtures/go/single-import-declarations.diffA-B.txt index 71ead9ca4..f6b326f7a 100644 --- a/test/fixtures/go/single-import-declarations.diffA-B.txt +++ b/test/fixtures/go/single-import-declarations.diffA-B.txt @@ -1,19 +1,18 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - { (StringLiteral) - ->(StringLiteral) })) - (Other "import_declaration" - (Import - { (StringLiteral) - ->(StringLiteral) })) - (Other "import_declaration" - (Import + (Import + { (TextElement) + ->(TextElement) }) + (Import + { (TextElement) + ->(TextElement) }) + (Import + ( (Identifier) - { (StringLiteral) - ->(StringLiteral) })) + { (TextElement) + ->(TextElement) })) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/single-import-declarations.diffB-A.txt b/test/fixtures/go/single-import-declarations.diffB-A.txt index 71ead9ca4..f6b326f7a 100644 --- a/test/fixtures/go/single-import-declarations.diffB-A.txt +++ b/test/fixtures/go/single-import-declarations.diffB-A.txt @@ -1,19 +1,18 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - { (StringLiteral) - ->(StringLiteral) })) - (Other "import_declaration" - (Import - { (StringLiteral) - ->(StringLiteral) })) - (Other "import_declaration" - (Import + (Import + { (TextElement) + ->(TextElement) }) + (Import + { (TextElement) + ->(TextElement) }) + (Import + ( (Identifier) - { (StringLiteral) - ->(StringLiteral) })) + { (TextElement) + ->(TextElement) })) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/single-import-declarations.parseA.txt b/test/fixtures/go/single-import-declarations.parseA.txt index b2cf532a7..8d5330836 100644 --- a/test/fixtures/go/single-import-declarations.parseA.txt +++ b/test/fixtures/go/single-import-declarations.parseA.txt @@ -1,16 +1,15 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - (StringLiteral))) - (Other "import_declaration" - (Import - (StringLiteral))) - (Other "import_declaration" - (Import + (Import + (TextElement)) + (Import + (TextElement)) + (Import + ( (Identifier) - (StringLiteral))) + (TextElement))) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/single-import-declarations.parseB.txt b/test/fixtures/go/single-import-declarations.parseB.txt index b2cf532a7..8d5330836 100644 --- a/test/fixtures/go/single-import-declarations.parseB.txt +++ b/test/fixtures/go/single-import-declarations.parseB.txt @@ -1,16 +1,15 @@ (Program (Module (Identifier)) - (Other "import_declaration" - (Import - (StringLiteral))) - (Other "import_declaration" - (Import - (StringLiteral))) - (Other "import_declaration" - (Import + (Import + (TextElement)) + (Import + (TextElement)) + (Import + ( (Identifier) - (StringLiteral))) + (TextElement))) (Function + (Empty) (Identifier) - (Args))) + ([]))) diff --git a/test/fixtures/go/single-line-function-declarations.diffA-B.txt b/test/fixtures/go/single-line-function-declarations.diffA-B.txt index f4a982702..5480b9ff3 100644 --- a/test/fixtures/go/single-line-function-declarations.diffA-B.txt +++ b/test/fixtures/go/single-line-function-declarations.diffA-B.txt @@ -2,27 +2,35 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args) - (FunctionCall - (Identifier))) + (Call + (Identifier) + (Empty))) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty)))) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier)))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))))) diff --git a/test/fixtures/go/single-line-function-declarations.diffB-A.txt b/test/fixtures/go/single-line-function-declarations.diffB-A.txt index f4a982702..5480b9ff3 100644 --- a/test/fixtures/go/single-line-function-declarations.diffB-A.txt +++ b/test/fixtures/go/single-line-function-declarations.diffB-A.txt @@ -2,27 +2,35 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args) - (FunctionCall - (Identifier))) + (Call + (Identifier) + (Empty))) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty)))) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier)))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))))) diff --git a/test/fixtures/go/single-line-function-declarations.parseA.txt b/test/fixtures/go/single-line-function-declarations.parseA.txt index acf895a2b..623e8d86b 100644 --- a/test/fixtures/go/single-line-function-declarations.parseA.txt +++ b/test/fixtures/go/single-line-function-declarations.parseA.txt @@ -2,24 +2,32 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier))) + (Call + (Identifier) + (Empty))) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty)))) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier)))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))))) diff --git a/test/fixtures/go/single-line-function-declarations.parseB.txt b/test/fixtures/go/single-line-function-declarations.parseB.txt index acf895a2b..623e8d86b 100644 --- a/test/fixtures/go/single-line-function-declarations.parseB.txt +++ b/test/fixtures/go/single-line-function-declarations.parseB.txt @@ -2,24 +2,32 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier))) + (Call + (Identifier) + (Empty))) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty)))) (Function + (Empty) (Identifier) - (Args) - (FunctionCall - (Identifier)) - (FunctionCall - (Identifier)))) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty))))) diff --git a/test/fixtures/go/slice-literals.diffA-B.txt b/test/fixtures/go/slice-literals.diffA-B.txt index 72f39aa72..269925ed9 100644 --- a/test/fixtures/go/slice-literals.diffA-B.txt +++ b/test/fixtures/go/slice-literals.diffA-B.txt @@ -2,36 +2,31 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - {+(StringLiteral)+}))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ( + {+(TextElement)+}))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - { (StringLiteral) - ->(StringLiteral) }))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ( + { (TextElement) + ->(TextElement) }))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - { (StringLiteral) - ->(StringLiteral) } - { (StringLiteral) - ->(StringLiteral) }))))))) + (Composite + (Slice + (Identifier)) + ( + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) })))))) diff --git a/test/fixtures/go/slice-literals.diffB-A.txt b/test/fixtures/go/slice-literals.diffB-A.txt index 9bb8343cc..77f717d4d 100644 --- a/test/fixtures/go/slice-literals.diffB-A.txt +++ b/test/fixtures/go/slice-literals.diffB-A.txt @@ -2,36 +2,31 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - {-(StringLiteral)-}))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ([] + {-(TextElement)-}))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - { (StringLiteral) - ->(StringLiteral) }))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ( + { (TextElement) + ->(TextElement) }))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - { (StringLiteral) - ->(StringLiteral) } - { (StringLiteral) - ->(StringLiteral) }))))))) + (Composite + (Slice + (Identifier)) + ( + { (TextElement) + ->(TextElement) } + { (TextElement) + ->(TextElement) })))))) diff --git a/test/fixtures/go/slice-literals.parseA.txt b/test/fixtures/go/slice-literals.parseA.txt index 9130a67f7..793f229bc 100644 --- a/test/fixtures/go/slice-literals.parseA.txt +++ b/test/fixtures/go/slice-literals.parseA.txt @@ -2,32 +2,27 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ([]))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ( + (TextElement)))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - (StringLiteral) - (StringLiteral)))))))) + (Composite + (Slice + (Identifier)) + ( + (TextElement) + (TextElement))))))) diff --git a/test/fixtures/go/slice-literals.parseB.txt b/test/fixtures/go/slice-literals.parseB.txt index d44c9bae8..95c762b15 100644 --- a/test/fixtures/go/slice-literals.parseB.txt +++ b/test/fixtures/go/slice-literals.parseB.txt @@ -2,33 +2,28 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ( + (TextElement)))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (Composite + (Slice + (Identifier)) + ( + (TextElement)))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (SliceTy - (Identifier)) - (Literal - (StringLiteral) - (StringLiteral)))))))) + (Composite + (Slice + (Identifier)) + ( + (TextElement) + (TextElement))))))) diff --git a/test/fixtures/go/slice-types.diffA-B.txt b/test/fixtures/go/slice-types.diffA-B.txt index c728d2175..c86133c56 100644 --- a/test/fixtures/go/slice-types.diffA-B.txt +++ b/test/fixtures/go/slice-types.diffA-B.txt @@ -2,19 +2,20 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - {+(SliceTy - {+(Identifier)+})+} - {-(Identifier)-}))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - {+(Identifier)+} - {-(SliceTy - {-(Identifier)-})-}))))) + ( + ( + (Annotation + (Identifier) + (Slice + { (Identifier) + ->(Slice + {+(Identifier)+}) }))) + ( + (Annotation + (Identifier) + (Slice + { (Slice + {-(Identifier)-}) + ->(Identifier) })))))) diff --git a/test/fixtures/go/slice-types.diffB-A.txt b/test/fixtures/go/slice-types.diffB-A.txt index f6071a10b..76add9bf7 100644 --- a/test/fixtures/go/slice-types.diffB-A.txt +++ b/test/fixtures/go/slice-types.diffB-A.txt @@ -2,19 +2,20 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - {+(Identifier)+} - {-(SliceTy - {-(Identifier)-})-}))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - {+(SliceTy - {+(Identifier)+})+} - {-(Identifier)-}))))) + ( + ( + (Annotation + (Identifier) + (Slice + { (Slice + {-(Identifier)-}) + ->(Identifier) }))) + ( + (Annotation + (Identifier) + (Slice + { (Identifier) + ->(Slice + {+(Identifier)+}) })))))) diff --git a/test/fixtures/go/slice-types.parseA.txt b/test/fixtures/go/slice-types.parseA.txt index e0562bdc0..53a712cc2 100644 --- a/test/fixtures/go/slice-types.parseA.txt +++ b/test/fixtures/go/slice-types.parseA.txt @@ -2,16 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - (Identifier)))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - (SliceTy - (Identifier))))))) + ( + ( + (Annotation + (Identifier) + (Slice + (Identifier)))) + ( + (Annotation + (Identifier) + (Slice + (Slice + (Identifier)))))))) diff --git a/test/fixtures/go/slice-types.parseB.txt b/test/fixtures/go/slice-types.parseB.txt index d12026ced..31875ab68 100644 --- a/test/fixtures/go/slice-types.parseB.txt +++ b/test/fixtures/go/slice-types.parseB.txt @@ -2,16 +2,17 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - (SliceTy - (Identifier))))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (SliceTy - (Identifier)))))) + ( + ( + (Annotation + (Identifier) + (Slice + (Slice + (Identifier))))) + ( + (Annotation + (Identifier) + (Slice + (Identifier))))))) diff --git a/test/fixtures/go/string-literals.diffA-B.txt b/test/fixtures/go/string-literals.diffA-B.txt index bf457e622..6273e762b 100644 --- a/test/fixtures/go/string-literals.diffA-B.txt +++ b/test/fixtures/go/string-literals.diffA-B.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (StringLiteral) - ->(StringLiteral) })) - (VarAssignment + { (TextElement) + ->(TextElement) }) + (Assignment (Identifier) - (Other "expression_list" - { (StringLiteral) - ->(StringLiteral) }))))) + { (TextElement) + ->(TextElement) })))) diff --git a/test/fixtures/go/string-literals.diffB-A.txt b/test/fixtures/go/string-literals.diffB-A.txt index bf457e622..6273e762b 100644 --- a/test/fixtures/go/string-literals.diffB-A.txt +++ b/test/fixtures/go/string-literals.diffB-A.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - { (StringLiteral) - ->(StringLiteral) })) - (VarAssignment + { (TextElement) + ->(TextElement) }) + (Assignment (Identifier) - (Other "expression_list" - { (StringLiteral) - ->(StringLiteral) }))))) + { (TextElement) + ->(TextElement) })))) diff --git a/test/fixtures/go/string-literals.parseA.txt b/test/fixtures/go/string-literals.parseA.txt index 95fa4d7c7..87c1e17bd 100644 --- a/test/fixtures/go/string-literals.parseA.txt +++ b/test/fixtures/go/string-literals.parseA.txt @@ -2,14 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (StringLiteral))) - (VarAssignment + (TextElement)) + (Assignment (Identifier) - (Other "expression_list" - (StringLiteral)))))) + (TextElement))))) diff --git a/test/fixtures/go/string-literals.parseB.txt b/test/fixtures/go/string-literals.parseB.txt index 95fa4d7c7..87c1e17bd 100644 --- a/test/fixtures/go/string-literals.parseB.txt +++ b/test/fixtures/go/string-literals.parseB.txt @@ -2,14 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (StringLiteral))) - (VarAssignment + (TextElement)) + (Assignment (Identifier) - (Other "expression_list" - (StringLiteral)))))) + (TextElement))))) diff --git a/test/fixtures/go/struct-field-declarations.diffA-B.txt b/test/fixtures/go/struct-field-declarations.diffA-B.txt index f1424b98d..81af7c572 100644 --- a/test/fixtures/go/struct-field-declarations.diffA-B.txt +++ b/test/fixtures/go/struct-field-declarations.diffA-B.txt @@ -2,15 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (StructTy - (FieldDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - {+(Identifier)+})))))) + (Constructor + (Empty) + {+(Error)+} + {-(Annotation + {-(Annotation + {-([])-} + {-(Identifier)-})-} + {-(Identifier)-})-}))))) diff --git a/test/fixtures/go/struct-field-declarations.diffB-A.txt b/test/fixtures/go/struct-field-declarations.diffB-A.txt index 6537ab98c..10d6b7740 100644 --- a/test/fixtures/go/struct-field-declarations.diffB-A.txt +++ b/test/fixtures/go/struct-field-declarations.diffB-A.txt @@ -2,15 +2,16 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (StructTy - (FieldDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - {-(Identifier)-})))))) + (Constructor + (Empty) + {+(Annotation + {+(Annotation + {+([])+} + {+(Identifier)+})+} + {+(Identifier)+})+} + {-(Error)-}))))) diff --git a/test/fixtures/go/struct-field-declarations.parseA.txt b/test/fixtures/go/struct-field-declarations.parseA.txt index 29195647a..cea38fdfc 100644 --- a/test/fixtures/go/struct-field-declarations.parseA.txt +++ b/test/fixtures/go/struct-field-declarations.parseA.txt @@ -2,12 +2,15 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (StructTy - (FieldDecl - (Identifier) + (Constructor + (Empty) + (Annotation + (Annotation + ([]) + (Identifier)) (Identifier))))))) diff --git a/test/fixtures/go/struct-field-declarations.parseB.txt b/test/fixtures/go/struct-field-declarations.parseB.txt index 1efa95abc..ac08c051e 100644 --- a/test/fixtures/go/struct-field-declarations.parseB.txt +++ b/test/fixtures/go/struct-field-declarations.parseB.txt @@ -2,13 +2,11 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl + ( + (Annotation (Identifier) - (StructTy - (FieldDecl - (Identifier) - (Identifier) - (Identifier))))))) + (Constructor + (Empty) + (Error)))))) diff --git a/test/fixtures/go/struct-literals.diffA-B.txt b/test/fixtures/go/struct-literals.diffA-B.txt index 5ed422b9c..4b7fa19ff 100644 --- a/test/fixtures/go/struct-literals.diffA-B.txt +++ b/test/fixtures/go/struct-literals.diffA-B.txt @@ -2,40 +2,38 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - { (Identifier) - ->(Identifier) } - (Pair + (Composite + { (Identifier) + ->(Identifier) } + ( + (KeyValue (Identifier) - (StringLiteral)) - (Pair + (TextElement)) + (KeyValue (Identifier) - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (TextElement))))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (StructTy - (FieldDecl - (Identifier) - { (Identifier) - ->(Identifier) })) - (Pair + (Composite + (Constructor + (Empty) + (Annotation + (Annotation + ([]) + (Identifier)) + { (Identifier) + ->(Identifier) })) + ( + (KeyValue { (Identifier) ->(Identifier) } - { (NumberLiteral) - ->(NumberLiteral) }))))) - (Other "const_declaration" - (VarAssignment + { (Integer) + ->(Integer) })))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - { (QualifiedType) - ->(QualifiedType) })))))) + (Error))))) diff --git a/test/fixtures/go/struct-literals.diffB-A.txt b/test/fixtures/go/struct-literals.diffB-A.txt index 5ed422b9c..4b7fa19ff 100644 --- a/test/fixtures/go/struct-literals.diffB-A.txt +++ b/test/fixtures/go/struct-literals.diffB-A.txt @@ -2,40 +2,38 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - { (Identifier) - ->(Identifier) } - (Pair + (Composite + { (Identifier) + ->(Identifier) } + ( + (KeyValue (Identifier) - (StringLiteral)) - (Pair + (TextElement)) + (KeyValue (Identifier) - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (TextElement))))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (StructTy - (FieldDecl - (Identifier) - { (Identifier) - ->(Identifier) })) - (Pair + (Composite + (Constructor + (Empty) + (Annotation + (Annotation + ([]) + (Identifier)) + { (Identifier) + ->(Identifier) })) + ( + (KeyValue { (Identifier) ->(Identifier) } - { (NumberLiteral) - ->(NumberLiteral) }))))) - (Other "const_declaration" - (VarAssignment + { (Integer) + ->(Integer) })))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - { (QualifiedType) - ->(QualifiedType) })))))) + (Error))))) diff --git a/test/fixtures/go/struct-literals.parseA.txt b/test/fixtures/go/struct-literals.parseA.txt index f598a40f2..3056c5fe2 100644 --- a/test/fixtures/go/struct-literals.parseA.txt +++ b/test/fixtures/go/struct-literals.parseA.txt @@ -2,35 +2,34 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (Identifier) - (Pair + (Composite + (Identifier) + ( + (KeyValue (Identifier) - (StringLiteral)) - (Pair + (TextElement)) + (KeyValue (Identifier) - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (TextElement))))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (StructTy - (FieldDecl - (Identifier) - (Identifier))) - (Pair + (Composite + (Constructor + (Empty) + (Annotation + (Annotation + ([]) + (Identifier)) + (Identifier))) + ( + (KeyValue (Identifier) - (NumberLiteral)))))) - (Other "const_declaration" - (VarAssignment + (Integer))))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (QualifiedType))))))) + (Error))))) diff --git a/test/fixtures/go/struct-literals.parseB.txt b/test/fixtures/go/struct-literals.parseB.txt index f598a40f2..3056c5fe2 100644 --- a/test/fixtures/go/struct-literals.parseB.txt +++ b/test/fixtures/go/struct-literals.parseB.txt @@ -2,35 +2,34 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "const_declaration" - (VarAssignment + ( + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (Identifier) - (Pair + (Composite + (Identifier) + ( + (KeyValue (Identifier) - (StringLiteral)) - (Pair + (TextElement)) + (KeyValue (Identifier) - (StringLiteral)))))) - (Other "const_declaration" - (VarAssignment + (TextElement))))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (StructTy - (FieldDecl - (Identifier) - (Identifier))) - (Pair + (Composite + (Constructor + (Empty) + (Annotation + (Annotation + ([]) + (Identifier)) + (Identifier))) + ( + (KeyValue (Identifier) - (NumberLiteral)))))) - (Other "const_declaration" - (VarAssignment + (Integer))))) + (Assignment (Identifier) - (Other "expression_list" - (Other "composite_literal" - (QualifiedType))))))) + (Error))))) diff --git a/test/fixtures/go/struct-types.diffA-B.txt b/test/fixtures/go/struct-types.diffA-B.txt index 6e590858c..c395c4872 100644 --- a/test/fixtures/go/struct-types.diffA-B.txt +++ b/test/fixtures/go/struct-types.diffA-B.txt @@ -2,37 +2,36 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy - (FieldDecl - (Identifier))))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy - (FieldDecl - (Identifier) - (Identifier) - (Identifier))))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy - (FieldDecl - (QualifiedType)) - (FieldDecl - (Identifier) - (Identifier) - (StringLiteral))))))) + ( + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty)))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Annotation + ([]) + (Identifier))))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Error)))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Error) + (Error))))))) diff --git a/test/fixtures/go/struct-types.diffB-A.txt b/test/fixtures/go/struct-types.diffB-A.txt index 6e590858c..c395c4872 100644 --- a/test/fixtures/go/struct-types.diffB-A.txt +++ b/test/fixtures/go/struct-types.diffB-A.txt @@ -2,37 +2,36 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy - (FieldDecl - (Identifier))))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy - (FieldDecl - (Identifier) - (Identifier) - (Identifier))))) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - (StructTy - (FieldDecl - (QualifiedType)) - (FieldDecl - (Identifier) - (Identifier) - (StringLiteral))))))) + ( + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty)))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Annotation + ([]) + (Identifier))))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Error)))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Error) + (Error))))))) diff --git a/test/fixtures/go/struct-types.parseA.txt b/test/fixtures/go/struct-types.parseA.txt index fc92335b7..1e89b4e56 100644 --- a/test/fixtures/go/struct-types.parseA.txt +++ b/test/fixtures/go/struct-types.parseA.txt @@ -2,33 +2,32 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy - (FieldDecl - (Identifier))))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy - (FieldDecl - (Identifier) - (Identifier) - (Identifier))))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy - (FieldDecl - (QualifiedType)) - (FieldDecl - (Identifier) - (Identifier) - (StringLiteral))))))) + ( + ( + (Annotation + (Identifier) + (Constructor + (Empty)))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Annotation + ([]) + (Identifier))))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Error)))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Error) + (Error))))))) diff --git a/test/fixtures/go/struct-types.parseB.txt b/test/fixtures/go/struct-types.parseB.txt index fc92335b7..1e89b4e56 100644 --- a/test/fixtures/go/struct-types.parseB.txt +++ b/test/fixtures/go/struct-types.parseB.txt @@ -2,33 +2,32 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy - (FieldDecl - (Identifier))))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy - (FieldDecl - (Identifier) - (Identifier) - (Identifier))))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (StructTy - (FieldDecl - (QualifiedType)) - (FieldDecl - (Identifier) - (Identifier) - (StringLiteral))))))) + ( + ( + (Annotation + (Identifier) + (Constructor + (Empty)))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Annotation + ([]) + (Identifier))))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Error)))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Error) + (Error))))))) diff --git a/test/fixtures/go/switch-statements.diffA-B.txt b/test/fixtures/go/switch-statements.diffA-B.txt index a75bae615..e31b62159 100644 --- a/test/fixtures/go/switch-statements.diffA-B.txt +++ b/test/fixtures/go/switch-statements.diffA-B.txt @@ -1,49 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - { (Identifier) - ->(Identifier) } - (Other "<") - { (Identifier) - ->(Identifier) }))) - (FunctionCall - (Identifier))) - {+(Case - {+(Case - {+(Other "expression_list" - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(Identifier)+})+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+} - (Case - (Case - (Other "expression_list" - (RelationalOperator - { (Identifier) - ->(Identifier) } - { (Other "<") - ->(Other "==") } - { (Identifier) - ->(NumberLiteral) }))) - (FunctionCall - { (Identifier) - ->(Identifier) })) - {-(Case - {-(Case - {-(Other "expression_list" - {-(RelationalOperator - {-(Identifier)-} - {-(Other "==")-} - {-(NumberLiteral)-})-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-}))) + (Error)) diff --git a/test/fixtures/go/switch-statements.diffB-A.txt b/test/fixtures/go/switch-statements.diffB-A.txt index ee63339c5..e31b62159 100644 --- a/test/fixtures/go/switch-statements.diffB-A.txt +++ b/test/fixtures/go/switch-statements.diffB-A.txt @@ -1,54 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - { (Identifier) - ->(Identifier) } - (Other "<") - { (Identifier) - ->(Identifier) }))) - (FunctionCall - (Identifier))) - {+(Case - {+(Case - {+(Other "expression_list" - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(Identifier)+})+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+} - {+(Case - {+(Case - {+(Other "expression_list" - {+(RelationalOperator - {+(Identifier)+} - {+(Other "==")+} - {+(NumberLiteral)+})+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+} - {-(Case - {-(Case - {-(Other "expression_list" - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(Identifier)-})-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-} - {-(Case - {-(Case - {-(Other "expression_list" - {-(RelationalOperator - {-(Identifier)-} - {-(Other "==")-} - {-(NumberLiteral)-})-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-}))) + (Error)) diff --git a/test/fixtures/go/switch-statements.parseA.txt b/test/fixtures/go/switch-statements.parseA.txt index 92237d7c3..e31b62159 100644 --- a/test/fixtures/go/switch-statements.parseA.txt +++ b/test/fixtures/go/switch-statements.parseA.txt @@ -1,34 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "==") - (NumberLiteral)))) - (FunctionCall - (Identifier)))))) + (Error)) diff --git a/test/fixtures/go/switch-statements.parseB.txt b/test/fixtures/go/switch-statements.parseB.txt index 92237d7c3..e31b62159 100644 --- a/test/fixtures/go/switch-statements.parseB.txt +++ b/test/fixtures/go/switch-statements.parseB.txt @@ -1,34 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "==") - (NumberLiteral)))) - (FunctionCall - (Identifier)))))) + (Error)) diff --git a/test/fixtures/go/type-assertion-expressions.diffA-B.txt b/test/fixtures/go/type-assertion-expressions.diffA-B.txt index 1a69da369..e31b62159 100644 --- a/test/fixtures/go/type-assertion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-assertion-expressions.diffA-B.txt @@ -1,11 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeAssertion - { (Identifier) - ->(Identifier) } - { (QualifiedType) - ->(QualifiedType) }))) + (Error)) diff --git a/test/fixtures/go/type-assertion-expressions.diffB-A.txt b/test/fixtures/go/type-assertion-expressions.diffB-A.txt index 1a69da369..e31b62159 100644 --- a/test/fixtures/go/type-assertion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-assertion-expressions.diffB-A.txt @@ -1,11 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeAssertion - { (Identifier) - ->(Identifier) } - { (QualifiedType) - ->(QualifiedType) }))) + (Error)) diff --git a/test/fixtures/go/type-assertion-expressions.parseA.txt b/test/fixtures/go/type-assertion-expressions.parseA.txt index a15f1c9f3..e31b62159 100644 --- a/test/fixtures/go/type-assertion-expressions.parseA.txt +++ b/test/fixtures/go/type-assertion-expressions.parseA.txt @@ -1,9 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeAssertion - (Identifier) - (QualifiedType)))) + (Error)) diff --git a/test/fixtures/go/type-assertion-expressions.parseB.txt b/test/fixtures/go/type-assertion-expressions.parseB.txt index a15f1c9f3..e31b62159 100644 --- a/test/fixtures/go/type-assertion-expressions.parseB.txt +++ b/test/fixtures/go/type-assertion-expressions.parseB.txt @@ -1,9 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeAssertion - (Identifier) - (QualifiedType)))) + (Error)) diff --git a/test/fixtures/go/type-conversion-expressions.diffA-B.txt b/test/fixtures/go/type-conversion-expressions.diffA-B.txt index 6af3d23d3..e31b62159 100644 --- a/test/fixtures/go/type-conversion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-conversion-expressions.diffA-B.txt @@ -1,41 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (SliceTy - { (QualifiedType) - ->(QualifiedType) }) - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })) - (TypeConversion - (ParenthesizedType - (SliceTy - { (QualifiedType) - ->(QualifiedType) })) - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })) - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) }) - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) }))) + (Error)) diff --git a/test/fixtures/go/type-conversion-expressions.diffB-A.txt b/test/fixtures/go/type-conversion-expressions.diffB-A.txt index 6af3d23d3..e31b62159 100644 --- a/test/fixtures/go/type-conversion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-conversion-expressions.diffB-A.txt @@ -1,41 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (SliceTy - { (QualifiedType) - ->(QualifiedType) }) - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })) - (TypeConversion - (ParenthesizedType - (SliceTy - { (QualifiedType) - ->(QualifiedType) })) - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })) - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) }) - (FunctionCall - (SubscriptAccess - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - { (Identifier) - ->(Identifier) }))) + (Error)) diff --git a/test/fixtures/go/type-conversion-expressions.parseA.txt b/test/fixtures/go/type-conversion-expressions.parseA.txt index 0dea327f8..e31b62159 100644 --- a/test/fixtures/go/type-conversion-expressions.parseA.txt +++ b/test/fixtures/go/type-conversion-expressions.parseA.txt @@ -1,29 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (SliceTy - (QualifiedType)) - (SubscriptAccess - (Identifier) - (Identifier))) - (TypeConversion - (ParenthesizedType - (SliceTy - (QualifiedType))) - (SubscriptAccess - (Identifier) - (Identifier))) - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (Identifier)) - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (Identifier)))) + (Error)) diff --git a/test/fixtures/go/type-conversion-expressions.parseB.txt b/test/fixtures/go/type-conversion-expressions.parseB.txt index 0dea327f8..e31b62159 100644 --- a/test/fixtures/go/type-conversion-expressions.parseB.txt +++ b/test/fixtures/go/type-conversion-expressions.parseB.txt @@ -1,29 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (TypeConversion - (SliceTy - (QualifiedType)) - (SubscriptAccess - (Identifier) - (Identifier))) - (TypeConversion - (ParenthesizedType - (SliceTy - (QualifiedType))) - (SubscriptAccess - (Identifier) - (Identifier))) - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (Identifier)) - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (Identifier)))) + (Error)) diff --git a/test/fixtures/go/type-declarations.diffA-B.txt b/test/fixtures/go/type-declarations.diffA-B.txt index dbb1db52d..82fb62cfe 100644 --- a/test/fixtures/go/type-declarations.diffA-B.txt +++ b/test/fixtures/go/type-declarations.diffA-B.txt @@ -2,22 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (TypeDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) + ( + (Error) + (Error)))) diff --git a/test/fixtures/go/type-declarations.diffB-A.txt b/test/fixtures/go/type-declarations.diffB-A.txt index dbb1db52d..82fb62cfe 100644 --- a/test/fixtures/go/type-declarations.diffB-A.txt +++ b/test/fixtures/go/type-declarations.diffB-A.txt @@ -2,22 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })) - (Other "type_declaration" - (TypeDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (TypeDecl - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) + ( + (Error) + (Error)))) diff --git a/test/fixtures/go/type-declarations.parseA.txt b/test/fixtures/go/type-declarations.parseA.txt index c9a2c3fcf..82fb62cfe 100644 --- a/test/fixtures/go/type-declarations.parseA.txt +++ b/test/fixtures/go/type-declarations.parseA.txt @@ -2,16 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Identifier))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Identifier)) - (TypeDecl - (Identifier) - (Identifier))))) + ( + (Error) + (Error)))) diff --git a/test/fixtures/go/type-declarations.parseB.txt b/test/fixtures/go/type-declarations.parseB.txt index c9a2c3fcf..82fb62cfe 100644 --- a/test/fixtures/go/type-declarations.parseB.txt +++ b/test/fixtures/go/type-declarations.parseB.txt @@ -2,16 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Identifier))) - (Other "type_declaration" - (TypeDecl - (Identifier) - (Identifier)) - (TypeDecl - (Identifier) - (Identifier))))) + ( + (Error) + (Error)))) diff --git a/test/fixtures/go/type-switch-statements.diffA-B.txt b/test/fixtures/go/type-switch-statements.diffA-B.txt index 8f2a7df7a..e31b62159 100644 --- a/test/fixtures/go/type-switch-statements.diffA-B.txt +++ b/test/fixtures/go/type-switch-statements.diffA-B.txt @@ -1,20 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - { (Identifier) - ->(Identifier) } - (Case - (Other "type_case" - (SliceTy - (Identifier))) - (FunctionCall - (Identifier))) - (Case - (Other "type_case" - (PointerTy - (Identifier))) - (Break))))) + (Error)) diff --git a/test/fixtures/go/type-switch-statements.diffB-A.txt b/test/fixtures/go/type-switch-statements.diffB-A.txt index 8f2a7df7a..e31b62159 100644 --- a/test/fixtures/go/type-switch-statements.diffB-A.txt +++ b/test/fixtures/go/type-switch-statements.diffB-A.txt @@ -1,20 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - { (Identifier) - ->(Identifier) } - (Case - (Other "type_case" - (SliceTy - (Identifier))) - (FunctionCall - (Identifier))) - (Case - (Other "type_case" - (PointerTy - (Identifier))) - (Break))))) + (Error)) diff --git a/test/fixtures/go/type-switch-statements.parseA.txt b/test/fixtures/go/type-switch-statements.parseA.txt index 7376ebe91..e31b62159 100644 --- a/test/fixtures/go/type-switch-statements.parseA.txt +++ b/test/fixtures/go/type-switch-statements.parseA.txt @@ -1,19 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Identifier) - (Case - (Other "type_case" - (SliceTy - (Identifier))) - (FunctionCall - (Identifier))) - (Case - (Other "type_case" - (PointerTy - (Identifier))) - (Break))))) + (Error)) diff --git a/test/fixtures/go/type-switch-statements.parseB.txt b/test/fixtures/go/type-switch-statements.parseB.txt index 7376ebe91..e31b62159 100644 --- a/test/fixtures/go/type-switch-statements.parseB.txt +++ b/test/fixtures/go/type-switch-statements.parseB.txt @@ -1,19 +1,4 @@ (Program (Module (Identifier)) - (Function - (Identifier) - (Args) - (Switch - (Identifier) - (Case - (Other "type_case" - (SliceTy - (Identifier))) - (FunctionCall - (Identifier))) - (Case - (Other "type_case" - (PointerTy - (Identifier))) - (Break))))) + (Error)) diff --git a/test/fixtures/go/unary-expressions.diffA-B.txt b/test/fixtures/go/unary-expressions.diffA-B.txt index fc1942c92..30352e42a 100644 --- a/test/fixtures/go/unary-expressions.diffA-B.txt +++ b/test/fixtures/go/unary-expressions.diffA-B.txt @@ -2,13 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Operator - (Operator - { (Identifier) - ->(Identifier) })) - (Operator - (FunctionCall - { (Identifier) - ->(Identifier) })))) + ( + (Not + (Error)) + (Error)))) diff --git a/test/fixtures/go/unary-expressions.diffB-A.txt b/test/fixtures/go/unary-expressions.diffB-A.txt index fc1942c92..30352e42a 100644 --- a/test/fixtures/go/unary-expressions.diffB-A.txt +++ b/test/fixtures/go/unary-expressions.diffB-A.txt @@ -2,13 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Operator - (Operator - { (Identifier) - ->(Identifier) })) - (Operator - (FunctionCall - { (Identifier) - ->(Identifier) })))) + ( + (Not + (Error)) + (Error)))) diff --git a/test/fixtures/go/unary-expressions.parseA.txt b/test/fixtures/go/unary-expressions.parseA.txt index 57aacef09..30352e42a 100644 --- a/test/fixtures/go/unary-expressions.parseA.txt +++ b/test/fixtures/go/unary-expressions.parseA.txt @@ -2,11 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Operator - (Operator - (Identifier))) - (Operator - (FunctionCall - (Identifier))))) + ( + (Not + (Error)) + (Error)))) diff --git a/test/fixtures/go/unary-expressions.parseB.txt b/test/fixtures/go/unary-expressions.parseB.txt index 57aacef09..30352e42a 100644 --- a/test/fixtures/go/unary-expressions.parseB.txt +++ b/test/fixtures/go/unary-expressions.parseB.txt @@ -2,11 +2,9 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Operator - (Operator - (Identifier))) - (Operator - (FunctionCall - (Identifier))))) + ( + (Not + (Error)) + (Error)))) diff --git a/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt b/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt index 4155b3571..17773cb02 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt @@ -2,17 +2,22 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - (Identifier))) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Identifier))))) + ( + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) }) + (Identifier)) + ([])) + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Identifier)) + ([]))))) diff --git a/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt b/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt index 4155b3571..17773cb02 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt @@ -2,17 +2,22 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - (Identifier))) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Identifier))))) + ( + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) }) + (Identifier)) + ([])) + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Identifier)) + ([]))))) diff --git a/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt b/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt index 5094a03cd..0d017abb4 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt @@ -2,14 +2,19 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Identifier))))) + ( + (Assignment + (Annotation + ( + (Identifier)) + (Identifier)) + ([])) + (Assignment + (Annotation + ( + (Identifier) + (Identifier)) + (Identifier)) + ([]))))) diff --git a/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt b/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt index 5094a03cd..0d017abb4 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt @@ -2,14 +2,19 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Identifier))))) + ( + (Assignment + (Annotation + ( + (Identifier)) + (Identifier)) + ([])) + (Assignment + (Annotation + ( + (Identifier) + (Identifier)) + (Identifier)) + ([]))))) diff --git a/test/fixtures/go/var-declarations-with-types.diffA-B.txt b/test/fixtures/go/var-declarations-with-types.diffA-B.txt index 1502bd374..ca0ebb1ce 100644 --- a/test/fixtures/go/var-declarations-with-types.diffA-B.txt +++ b/test/fixtures/go/var-declarations-with-types.diffA-B.txt @@ -2,22 +2,24 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "expression_list" - (NumberLiteral)))) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + ( + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) }) + (Identifier)) + (Integer)) + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Identifier)) + ( + (Integer) + (Integer)))))) diff --git a/test/fixtures/go/var-declarations-with-types.diffB-A.txt b/test/fixtures/go/var-declarations-with-types.diffB-A.txt index 1502bd374..ca0ebb1ce 100644 --- a/test/fixtures/go/var-declarations-with-types.diffB-A.txt +++ b/test/fixtures/go/var-declarations-with-types.diffB-A.txt @@ -2,22 +2,24 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "expression_list" - (NumberLiteral)))) - (Other "var_declaration" - (VarAssignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + ( + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) }) + (Identifier)) + (Integer)) + (Assignment + (Annotation + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Identifier)) + ( + (Integer) + (Integer)))))) diff --git a/test/fixtures/go/var-declarations-with-types.parseA.txt b/test/fixtures/go/var-declarations-with-types.parseA.txt index 964cdefc6..add301f11 100644 --- a/test/fixtures/go/var-declarations-with-types.parseA.txt +++ b/test/fixtures/go/var-declarations-with-types.parseA.txt @@ -2,19 +2,21 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral)))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + ( + (Assignment + (Annotation + ( + (Identifier)) + (Identifier)) + (Integer)) + (Assignment + (Annotation + ( + (Identifier) + (Identifier)) + (Identifier)) + ( + (Integer) + (Integer)))))) diff --git a/test/fixtures/go/var-declarations-with-types.parseB.txt b/test/fixtures/go/var-declarations-with-types.parseB.txt index 964cdefc6..add301f11 100644 --- a/test/fixtures/go/var-declarations-with-types.parseB.txt +++ b/test/fixtures/go/var-declarations-with-types.parseB.txt @@ -2,19 +2,21 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral)))) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + ( + (Assignment + (Annotation + ( + (Identifier)) + (Identifier)) + (Integer)) + (Assignment + (Annotation + ( + (Identifier) + (Identifier)) + (Identifier)) + ( + (Integer) + (Integer)))))) diff --git a/test/fixtures/go/var-declarations-without-types.diffA-B.txt b/test/fixtures/go/var-declarations-without-types.diffA-B.txt index 87f5053a3..804caeb9b 100644 --- a/test/fixtures/go/var-declarations-without-types.diffA-B.txt +++ b/test/fixtures/go/var-declarations-without-types.diffA-B.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - { (VarAssignment - {-(Identifier)-} - {-(Other "expression_list" - {-(NumberLiteral)-})-}) - ->(VarAssignment + (Assignment + { (Identifier) + ->( {+(Identifier)+} - {+(Identifier)+} - {+(Other "expression_list" - {+(NumberLiteral)+} - {+(NumberLiteral)+})+}) }))) + {+(Identifier)+}) } + { (Integer) + ->( + {+(Integer)+} + {+(Integer)+}) }))) diff --git a/test/fixtures/go/var-declarations-without-types.diffB-A.txt b/test/fixtures/go/var-declarations-without-types.diffB-A.txt index dd54f56b8..7796835c1 100644 --- a/test/fixtures/go/var-declarations-without-types.diffB-A.txt +++ b/test/fixtures/go/var-declarations-without-types.diffB-A.txt @@ -2,16 +2,14 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - { (VarAssignment + (Assignment + { ( {-(Identifier)-} - {-(Identifier)-} - {-(Other "expression_list" - {-(NumberLiteral)-} - {-(NumberLiteral)-})-}) - ->(VarAssignment - {+(Identifier)+} - {+(Other "expression_list" - {+(NumberLiteral)+})+}) }))) + {-(Identifier)-}) + ->(Identifier) } + { ( + {-(Integer)-} + {-(Integer)-}) + ->(Integer) }))) diff --git a/test/fixtures/go/var-declarations-without-types.parseA.txt b/test/fixtures/go/var-declarations-without-types.parseA.txt index 39a5c70b7..a2d50974f 100644 --- a/test/fixtures/go/var-declarations-without-types.parseA.txt +++ b/test/fixtures/go/var-declarations-without-types.parseA.txt @@ -2,10 +2,8 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment - (Identifier) - (Other "expression_list" - (NumberLiteral)))))) + (Assignment + (Identifier) + (Integer)))) diff --git a/test/fixtures/go/var-declarations-without-types.parseB.txt b/test/fixtures/go/var-declarations-without-types.parseB.txt index 48c8dd34c..bfcfcf674 100644 --- a/test/fixtures/go/var-declarations-without-types.parseB.txt +++ b/test/fixtures/go/var-declarations-without-types.parseB.txt @@ -2,12 +2,12 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args) - (Other "var_declaration" - (VarAssignment + (Assignment + ( (Identifier) - (Identifier) - (Other "expression_list" - (NumberLiteral) - (NumberLiteral)))))) + (Identifier)) + ( + (Integer) + (Integer))))) diff --git a/test/fixtures/go/variadic-function-declarations.diffA-B.txt b/test/fixtures/go/variadic-function-declarations.diffA-B.txt index d5ad0725a..0a9deebbd 100644 --- a/test/fixtures/go/variadic-function-declarations.diffA-B.txt +++ b/test/fixtures/go/variadic-function-declarations.diffA-B.txt @@ -2,26 +2,28 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args - (ParameterDecl - (PointerTy - (Identifier)) - (Identifier)))) - (Function - { (Identifier) - ->(Identifier) } - (Args - (ParameterDecl - (Identifier)))) - (Function - { (Identifier) - ->(Identifier) } - (Args + ( (Identifier) - (ParameterDecl - (Identifier))))) + (Pointer + (Identifier))) + ([])) + (Function + (Empty) + { (Identifier) + ->(Identifier) } + (Identifier) + ([])) + (Function + (Empty) + { (Identifier) + ->(Identifier) } + (Identifier) + (Identifier) + ([]))) diff --git a/test/fixtures/go/variadic-function-declarations.diffB-A.txt b/test/fixtures/go/variadic-function-declarations.diffB-A.txt index d5ad0725a..0a9deebbd 100644 --- a/test/fixtures/go/variadic-function-declarations.diffB-A.txt +++ b/test/fixtures/go/variadic-function-declarations.diffB-A.txt @@ -2,26 +2,28 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) { (Identifier) ->(Identifier) } - (Args - (ParameterDecl - (PointerTy - (Identifier)) - (Identifier)))) - (Function - { (Identifier) - ->(Identifier) } - (Args - (ParameterDecl - (Identifier)))) - (Function - { (Identifier) - ->(Identifier) } - (Args + ( (Identifier) - (ParameterDecl - (Identifier))))) + (Pointer + (Identifier))) + ([])) + (Function + (Empty) + { (Identifier) + ->(Identifier) } + (Identifier) + ([])) + (Function + (Empty) + { (Identifier) + ->(Identifier) } + (Identifier) + (Identifier) + ([]))) diff --git a/test/fixtures/go/variadic-function-declarations.parseA.txt b/test/fixtures/go/variadic-function-declarations.parseA.txt index 007344c4f..f8f6ce103 100644 --- a/test/fixtures/go/variadic-function-declarations.parseA.txt +++ b/test/fixtures/go/variadic-function-declarations.parseA.txt @@ -2,23 +2,25 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args - (ParameterDecl - (PointerTy - (Identifier)) - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier)))) - (Function - (Identifier) - (Args + ( (Identifier) - (ParameterDecl - (Identifier))))) + (Pointer + (Identifier))) + ([])) + (Function + (Empty) + (Identifier) + (Identifier) + ([])) + (Function + (Empty) + (Identifier) + (Identifier) + (Identifier) + ([]))) diff --git a/test/fixtures/go/variadic-function-declarations.parseB.txt b/test/fixtures/go/variadic-function-declarations.parseB.txt index 007344c4f..f8f6ce103 100644 --- a/test/fixtures/go/variadic-function-declarations.parseB.txt +++ b/test/fixtures/go/variadic-function-declarations.parseB.txt @@ -2,23 +2,25 @@ (Module (Identifier)) (Function + (Empty) (Identifier) - (Args)) + ([])) (Function + (Empty) (Identifier) - (Args - (ParameterDecl - (PointerTy - (Identifier)) - (Identifier)))) - (Function - (Identifier) - (Args - (ParameterDecl - (Identifier)))) - (Function - (Identifier) - (Args + ( (Identifier) - (ParameterDecl - (Identifier))))) + (Pointer + (Identifier))) + ([])) + (Function + (Empty) + (Identifier) + (Identifier) + ([])) + (Function + (Empty) + (Identifier) + (Identifier) + (Identifier) + ([]))) From 1f772e1ea5ff02e2633dd4807108a7acc0ca3ae0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 16:48:07 -0700 Subject: [PATCH 020/176] Assign call expression params --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 2b0111ceb..fbee287a2 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -308,7 +308,7 @@ block :: Assignment block = symbol Block *> children expressions callExpression :: Assignment -callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> identifier <*> pure [] <*> emptyTerm) +callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> identifier <*> many expression <*> emptyTerm) varDeclaration :: Assignment varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions From fd5ac9903d8c0969a693e13de2c06871cd715c28 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 17:37:47 -0700 Subject: [PATCH 021/176] Fix typo --- src/Data/Syntax/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index 38d6bf205..555b850bf 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -151,7 +151,7 @@ tracing f = case getCallStack callStack of -- | Zero-width production of the current location. -- --- If assigning at the end of input or at the end of a list of children, the loccation will be returned as an empty Range and Span at the current offset. Otherwise, it will be the Range and Span of the current node. +-- If assigning at the end of input or at the end of a list of children, the location will be returned as an empty Range and Span at the current offset. Otherwise, it will be the Range and Span of the current node. location :: HasCallStack => Assignment ast grammar (Record Location) location = tracing Location `Then` return From 02adafb52623b77a5b4e635b7754c47272df0e25 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 17:38:24 -0700 Subject: [PATCH 022/176] Add Go.Syntax for Variadic function arguments / parameters --- src/Language/Go/Syntax.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Language/Go/Syntax.hs diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs new file mode 100644 index 000000000..96e6568d6 --- /dev/null +++ b/src/Language/Go/Syntax.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE DeriveAnyClass #-} +module Language.Go.Syntax where + +import Algorithm +import Data.Align.Generic +import Data.Functor.Classes.Eq.Generic +import Data.Functor.Classes.Ord.Generic +import Data.Functor.Classes.Show.Generic +import Data.Mergeable +import GHC.Generics + +-- | Variadic (`...Type` used in function declarations, and `Type...` used in function calls). +newtype Variadic a = Variadic a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Variadic where liftEq = genericLiftEq +instance Ord1 Variadic where liftCompare = genericLiftCompare +instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec From 19532ff2d44d789e35ff878b07b89736bffeba09 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 24 Oct 2017 17:38:53 -0700 Subject: [PATCH 023/176] Assign variadic arguments :broken_heart: - There's a limitation to this that requires some additional work. --- src/Language/Go/Assignment.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index fbee287a2..a490755ee 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -23,6 +23,7 @@ import qualified Data.Term as Term import Data.Union import GHC.Stack import Language.Go.Grammar as Grammar +import Language.Go.Syntax as Go.Syntax type Syntax = '[ Comment.Comment @@ -39,6 +40,7 @@ type Syntax = , Statement.PostDecrement , Statement.PostIncrement , Expression.MemberAccess + , Go.Syntax.Variadic , Literal.Array , Literal.Channel , Literal.Composite @@ -84,6 +86,7 @@ expression = term (handleError (choice expressionChoices)) expressionChoices :: [Assignment.Assignment [] Grammar Term] expressionChoices = [ assignment' + , variadicArgument , binaryExpression , block , breakStatement @@ -166,7 +169,8 @@ typeIdentifier :: Assignment typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier <$> source) identifier :: Assignment -identifier = makeTerm <$> symbol Identifier <*> (Syntax.Identifier <$> source) +identifier = symbol Identifier >>= \ loc -> (source >> symbol AnonDotDotDot *> (makeTerm loc <$> (Go.Syntax.Variadic <$> (makeTerm loc <$> (Syntax.Identifier <$> source))))) + <|> (makeTerm loc <$> (Syntax.Identifier <$> source)) fieldIdentifier :: Assignment fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier <$> source) @@ -307,6 +311,9 @@ binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm block :: Assignment block = symbol Block *> children expressions +variadicArgument :: Assignment +variadicArgument = symbol Identifier >>= \ loc -> children (symbol AnonDotDotDot *> (makeTerm loc <$> (Go.Syntax.Variadic <$> (makeTerm loc <$> (Syntax.Identifier <$> source))))) + callExpression :: Assignment callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> identifier <*> many expression <*> emptyTerm) From a9d2a4c208e8a0f24ecbd5a6bdfd17dae24ca8e6 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 25 Oct 2017 13:52:26 -0700 Subject: [PATCH 024/176] Bump haskell-tree-sitter --- vendor/haskell-tree-sitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index c43d8ac2a..6df4e3a6a 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit c43d8ac2a229f84aeda19b5a36cfb6ccf67196f6 +Subproject commit 6df4e3a6a145eab63f4a1beb110f4174cb1fd37a From 5bf43aad8e5a67246a8ca67460e43cb43e87bd7e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 25 Oct 2017 15:22:54 -0700 Subject: [PATCH 025/176] Bump haskell-tree-sitter --- vendor/haskell-tree-sitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index 6df4e3a6a..5acb18dee 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit 6df4e3a6a145eab63f4a1beb110f4174cb1fd37a +Subproject commit 5acb18dee84b980cf46b28aa57538be775bb0047 From 840d6868919a9863021857639a82615aede9673b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 25 Oct 2017 16:39:21 -0700 Subject: [PATCH 026/176] Update Variadic to contain a context - This is useful for capturing the type information for a variadic argument or parameter --- src/Language/Go/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 96e6568d6..59eb2fd64 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -10,7 +10,7 @@ import Data.Mergeable import GHC.Generics -- | Variadic (`...Type` used in function declarations, and `Type...` used in function calls). -newtype Variadic a = Variadic a +data Variadic a = Variadic { variadicContext :: [a], variadicIdentifier :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Variadic where liftEq = genericLiftEq From f7b84c7edbe722d2889a46718a2bdb40a7c4916b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 25 Oct 2017 16:41:24 -0700 Subject: [PATCH 027/176] Assign variadic parameter declarations --- src/Language/Go/Assignment.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index a490755ee..4fea25bdd 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -135,6 +135,7 @@ expressionChoices = , typeDeclaration , typeIdentifier , unaryExpression + , variadicParameterDeclaration ] identifiers :: Assignment @@ -338,6 +339,12 @@ functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') parameters = symbol Parameters *> children (many expression) +variadicParameterDeclaration :: Assignment +variadicParameterDeclaration = mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> emptyTerm <*> expression) + <|> mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> expression <*> expression) + where + mkVariadic loc (identifier', typeIdentifier') = makeTerm loc (Go.Syntax.Variadic [typeIdentifier'] identifier') + importDeclaration :: Assignment importDeclaration = makeTerm <$> symbol ImportDeclaration <*> children (Declaration.Import <$> many expression) From 396a0a0cef966c1386b8998cfa6d08764f14257a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 25 Oct 2017 16:43:21 -0700 Subject: [PATCH 028/176] Update variadic argument assignment --- src/Language/Go/Assignment.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 4fea25bdd..5091e7877 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -86,7 +86,6 @@ expression = term (handleError (choice expressionChoices)) expressionChoices :: [Assignment.Assignment [] Grammar Term] expressionChoices = [ assignment' - , variadicArgument , binaryExpression , block , breakStatement @@ -135,6 +134,7 @@ expressionChoices = , typeDeclaration , typeIdentifier , unaryExpression + , variadicArgument , variadicParameterDeclaration ] @@ -170,8 +170,7 @@ typeIdentifier :: Assignment typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier <$> source) identifier :: Assignment -identifier = symbol Identifier >>= \ loc -> (source >> symbol AnonDotDotDot *> (makeTerm loc <$> (Go.Syntax.Variadic <$> (makeTerm loc <$> (Syntax.Identifier <$> source))))) - <|> (makeTerm loc <$> (Syntax.Identifier <$> source)) +identifier = makeTerm <$> symbol Identifier <*> (Syntax.Identifier <$> source) fieldIdentifier :: Assignment fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier <$> source) @@ -313,7 +312,7 @@ block :: Assignment block = symbol Block *> children expressions variadicArgument :: Assignment -variadicArgument = symbol Identifier >>= \ loc -> children (symbol AnonDotDotDot *> (makeTerm loc <$> (Go.Syntax.Variadic <$> (makeTerm loc <$> (Syntax.Identifier <$> source))))) +variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic <$> pure [] <*> expression) callExpression :: Assignment callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> identifier <*> many expression <*> emptyTerm) From f949980f55be361cde7c188494c3fab1d0816ca3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 14:08:50 -0700 Subject: [PATCH 029/176] Add Language.Go.Syntax to cabal file --- semantic-diff.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/semantic-diff.cabal b/semantic-diff.cabal index 1535ac4c0..dbcb1c038 100644 --- a/semantic-diff.cabal +++ b/semantic-diff.cabal @@ -54,6 +54,7 @@ library , Language.Go , Language.Go.Grammar , Language.Go.Assignment + , Language.Go.Syntax , Language.JSON.Grammar , Language.JSON.Assignment , Language.Ruby.Grammar From d69b16cc8a4c7ac3de65c8ff11d60e956f404db4 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 16:32:00 -0700 Subject: [PATCH 030/176] Bump haskell-tree-sitter: default case expressions in Go --- vendor/haskell-tree-sitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index 5acb18dee..46d51913c 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit 5acb18dee84b980cf46b28aa57538be775bb0047 +Subproject commit 46d51913c232847920763d039b435ef993bb44d6 From 8b9858f312bf537b2a2be6978240aeafba3973f8 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 17:49:18 -0700 Subject: [PATCH 031/176] Add DefaultPattern constructor for Go Syntax --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 59eb2fd64..9c00f694d 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -16,3 +16,11 @@ data Variadic a = Variadic { variadicContext :: [a], variadicIdentifier :: a } instance Eq1 Variadic where liftEq = genericLiftEq instance Ord1 Variadic where liftCompare = genericLiftCompare instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec + +-- | A pattern in a pattern-matching or computed jump control-flow statement, like 'case' in C or JavaScript, 'when' in Ruby, or the left-hand side of '->' in the body of Haskell 'case' expressions. +data DefaultPattern a = DefaultPattern { patternBody :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 DefaultPattern where liftEq = genericLiftEq +instance Ord1 DefaultPattern where liftCompare = genericLiftCompare +instance Show1 DefaultPattern where liftShowsPrec = genericLiftShowsPrec From fa274a5a41d313207652d1e3e44768e1929754c9 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 17:50:16 -0700 Subject: [PATCH 032/176] Assign switch statements --- src/Language/Go/Assignment.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 5091e7877..67d2c033f 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -40,6 +40,7 @@ type Syntax = , Statement.PostDecrement , Statement.PostIncrement , Expression.MemberAccess + , Go.Syntax.DefaultPattern , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -52,6 +53,8 @@ type Syntax = , Statement.Break , Statement.Goto , Statement.If + , Statement.Match + , Statement.Pattern , Statement.Pointer , Statement.Reference , Statement.Return @@ -98,7 +101,9 @@ expressionChoices = , decStatement , element , elseClause + , expressionCaseClause , expressionList + , expressionSwitchStatement , fieldDeclaration , fieldIdentifier , functionDeclaration @@ -311,6 +316,20 @@ binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm block :: Assignment block = symbol Block *> children expressions +expressionCase :: Assignment +expressionCase = makeTerm <$> symbol ExpressionCase <*> (Statement.Pattern <$> children expressions <*> expressions) + +defaultExpressionCase :: Assignment +defaultExpressionCase = makeTerm <$> symbol DefaultExpressionCase <* source <*> (Go.Syntax.DefaultPattern <$> expressions) + +expressionCaseClause :: Assignment +expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultExpressionCase) + +expressionSwitchStatement :: Assignment +expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> children (Statement.Match <$> (expression <|> emptyTerm) <*> (expressionCaseClauses <|> emptyTerm)) + where + expressionCaseClauses = makeTerm <$> location <*> many expressionCaseClause + variadicArgument :: Assignment variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic <$> pure [] <*> expression) From 328e6f69cff1cb3da663a4af3f5de380796f860e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 17:50:25 -0700 Subject: [PATCH 033/176] Assign fall through statements --- src/Language/Go/Assignment.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 67d2c033f..04225ea7c 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -104,6 +104,7 @@ expressionChoices = , expressionCaseClause , expressionList , expressionSwitchStatement + , fallThroughStatement , fieldDeclaration , fieldIdentifier , functionDeclaration @@ -330,6 +331,9 @@ expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> ch where expressionCaseClauses = makeTerm <$> location <*> many expressionCaseClause +fallThroughStatement :: Assignment +fallThroughStatement = makeTerm <$> symbol FallthroughStatement <*> (Statement.Pattern <$> (makeTerm <$> location <*> (Syntax.Identifier <$> source)) <*> emptyTerm) + variadicArgument :: Assignment variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic <$> pure [] <*> expression) From dbb454eb0857c5e8ffca3043982e9d611ab0999a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 17:50:39 -0700 Subject: [PATCH 034/176] Not all break statements have labels --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 04225ea7c..33e870336 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -423,7 +423,7 @@ shortVarDeclaration :: Assignment shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment <$> pure [] <*> expression <*> expression) breakStatement :: Assignment -breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> labelName) +breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (labelName <|> emptyTerm)) decStatement :: Assignment decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression) From bd9721f677b66c8fd33130918303473126871aff Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 30 Oct 2017 17:50:57 -0700 Subject: [PATCH 035/176] Enhance Go switch test fixture --- test/fixtures/go/case-statements.B.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/fixtures/go/case-statements.B.go b/test/fixtures/go/case-statements.B.go index 27b709089..26aab565d 100644 --- a/test/fixtures/go/case-statements.B.go +++ b/test/fixtures/go/case-statements.B.go @@ -2,4 +2,13 @@ package main func main() { switch { case foo: f1() } +switch e { +case 1, 2: +a() +b() +fallthrough +default: +c() +break +} } From 2e79bb65426b841868ab04ed63c233bd836ba20f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 10:33:37 -0700 Subject: [PATCH 036/176] Update case / switch statement tests --- test/fixtures/go/case-statements.diffA-B.txt | 39 ++++++++++++++++++- test/fixtures/go/case-statements.diffB-A.txt | 39 ++++++++++++++++++- test/fixtures/go/case-statements.parseA.txt | 7 +++- test/fixtures/go/case-statements.parseB.txt | 36 ++++++++++++++++- .../fixtures/go/switch-statements.diffA-B.txt | 33 +++++++++++++++- .../fixtures/go/switch-statements.diffB-A.txt | 33 +++++++++++++++- test/fixtures/go/switch-statements.parseA.txt | 27 ++++++++++++- test/fixtures/go/switch-statements.parseB.txt | 27 ++++++++++++- 8 files changed, 233 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/case-statements.diffA-B.txt b/test/fixtures/go/case-statements.diffA-B.txt index e31b62159..74670a2a8 100644 --- a/test/fixtures/go/case-statements.diffA-B.txt +++ b/test/fixtures/go/case-statements.diffA-B.txt @@ -1,4 +1,41 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + { (Match + {-(Empty)-} + {-([])-}) + ->( + {+(Match + {+(Pattern + {+(Identifier)+} + {+(Call + {+(Identifier)+} + {+(Empty)+})+})+} + {+([])+})+} + {+(Match + {+(Identifier)+} + {+( + {+(Pattern + {+( + {+(Integer)+} + {+(Integer)+})+} + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Pattern + {+(Identifier)+} + {+(Empty)+})+})+})+} + {+(DefaultPattern + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Break + {+(Empty)+})+})+})+})+})+}) })) diff --git a/test/fixtures/go/case-statements.diffB-A.txt b/test/fixtures/go/case-statements.diffB-A.txt index e31b62159..90cb66111 100644 --- a/test/fixtures/go/case-statements.diffB-A.txt +++ b/test/fixtures/go/case-statements.diffB-A.txt @@ -1,4 +1,41 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + { ( + {-(Match + {-(Pattern + {-(Identifier)-} + {-(Call + {-(Identifier)-} + {-(Empty)-})-})-} + {-([])-})-} + {-(Match + {-(Identifier)-} + {-( + {-(Pattern + {-( + {-(Integer)-} + {-(Integer)-})-} + {-( + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Pattern + {-(Identifier)-} + {-(Empty)-})-})-})-} + {-(DefaultPattern + {-( + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Break + {-(Empty)-})-})-})-})-})-}) + ->(Match + {+(Empty)+} + {+([])+}) })) diff --git a/test/fixtures/go/case-statements.parseA.txt b/test/fixtures/go/case-statements.parseA.txt index e31b62159..c847c36b2 100644 --- a/test/fixtures/go/case-statements.parseA.txt +++ b/test/fixtures/go/case-statements.parseA.txt @@ -1,4 +1,9 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Match + (Empty) + ([])))) diff --git a/test/fixtures/go/case-statements.parseB.txt b/test/fixtures/go/case-statements.parseB.txt index e31b62159..c4c4eeb50 100644 --- a/test/fixtures/go/case-statements.parseB.txt +++ b/test/fixtures/go/case-statements.parseB.txt @@ -1,4 +1,38 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Match + (Pattern + (Identifier) + (Call + (Identifier) + (Empty))) + ([])) + (Match + (Identifier) + ( + (Pattern + ( + (Integer) + (Integer)) + ( + (Call + (Identifier) + (Empty)) + (Call + (Identifier) + (Empty)) + (Pattern + (Identifier) + (Empty)))) + (DefaultPattern + ( + (Call + (Identifier) + (Empty)) + (Break + (Empty))))))))) diff --git a/test/fixtures/go/switch-statements.diffA-B.txt b/test/fixtures/go/switch-statements.diffA-B.txt index e31b62159..ba6d7b831 100644 --- a/test/fixtures/go/switch-statements.diffA-B.txt +++ b/test/fixtures/go/switch-statements.diffA-B.txt @@ -1,4 +1,35 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Match + (Pattern + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Call + (Identifier) + (Empty))) + ( + (Pattern + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Call + (Identifier) + (Empty))) + (Pattern + (Equal + { (Identifier) + ->(Identifier) } + (Integer)) + (Call + { (Identifier) + ->(Identifier) } + (Empty))))))) diff --git a/test/fixtures/go/switch-statements.diffB-A.txt b/test/fixtures/go/switch-statements.diffB-A.txt index e31b62159..ba6d7b831 100644 --- a/test/fixtures/go/switch-statements.diffB-A.txt +++ b/test/fixtures/go/switch-statements.diffB-A.txt @@ -1,4 +1,35 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Match + (Pattern + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Call + (Identifier) + (Empty))) + ( + (Pattern + (LessThan + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Call + (Identifier) + (Empty))) + (Pattern + (Equal + { (Identifier) + ->(Identifier) } + (Integer)) + (Call + { (Identifier) + ->(Identifier) } + (Empty))))))) diff --git a/test/fixtures/go/switch-statements.parseA.txt b/test/fixtures/go/switch-statements.parseA.txt index e31b62159..c8e2b46c1 100644 --- a/test/fixtures/go/switch-statements.parseA.txt +++ b/test/fixtures/go/switch-statements.parseA.txt @@ -1,4 +1,29 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Match + (Pattern + (LessThan + (Identifier) + (Identifier)) + (Call + (Identifier) + (Empty))) + ( + (Pattern + (LessThan + (Identifier) + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Equal + (Identifier) + (Integer)) + (Call + (Identifier) + (Empty))))))) diff --git a/test/fixtures/go/switch-statements.parseB.txt b/test/fixtures/go/switch-statements.parseB.txt index e31b62159..c8e2b46c1 100644 --- a/test/fixtures/go/switch-statements.parseB.txt +++ b/test/fixtures/go/switch-statements.parseB.txt @@ -1,4 +1,29 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Match + (Pattern + (LessThan + (Identifier) + (Identifier)) + (Call + (Identifier) + (Empty))) + ( + (Pattern + (LessThan + (Identifier) + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Equal + (Identifier) + (Integer)) + (Call + (Identifier) + (Empty))))))) From 4c3a9c32141f79e3e4f536d3827041bccf0878bb Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 11:18:51 -0700 Subject: [PATCH 037/176] Update order to correctly assign `chan<- <-chan` types --- src/Language/Go/Assignment.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 33e870336..0614617b2 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -215,8 +215,8 @@ sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expressio channelType :: Assignment channelType = handleError - $ (makeTerm <$> symbol ChannelType <*> (children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression)))) - <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) + $ (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) + <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression)))) <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> (Type.BiDirectionalChannel <$> expression)))) structType :: Assignment From 596fa7097b6d0a7bbc4875e9f8bfeef9b559d542 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 11:21:34 -0700 Subject: [PATCH 038/176] Update channel test fixtures --- test/fixtures/go/channel-types.diffA-B.txt | 29 ++++++++++++++-------- test/fixtures/go/channel-types.diffB-A.txt | 29 ++++++++++++++-------- test/fixtures/go/channel-types.parseA.txt | 13 +++++++--- test/fixtures/go/channel-types.parseB.txt | 13 +++++++--- 4 files changed, 58 insertions(+), 26 deletions(-) diff --git a/test/fixtures/go/channel-types.diffA-B.txt b/test/fixtures/go/channel-types.diffA-B.txt index 85cb4138d..24bc03596 100644 --- a/test/fixtures/go/channel-types.diffA-B.txt +++ b/test/fixtures/go/channel-types.diffA-B.txt @@ -5,15 +5,24 @@ (Empty) (Identifier) ( - {-(Annotation - {-(Identifier)-} - {-(Error)-})-} (Annotation - (Identifier) - (Error)) + { (Identifier) + ->(Identifier) } + (SendChannel + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }))) (Annotation - (Identifier) - (Error)) - {+(Annotation - {+(Identifier)+} - {+(Error)+})+}))) + { (Identifier) + ->(Identifier) } + (SendChannel + (BiDirectionalChannel + (Constructor + (Empty))))) + (Annotation + { (Identifier) + ->(Identifier) } + (SendChannel + (ReceiveChannel + { (Identifier) + ->(Identifier) })))))) diff --git a/test/fixtures/go/channel-types.diffB-A.txt b/test/fixtures/go/channel-types.diffB-A.txt index 2ef2238a3..24bc03596 100644 --- a/test/fixtures/go/channel-types.diffB-A.txt +++ b/test/fixtures/go/channel-types.diffB-A.txt @@ -5,15 +5,24 @@ (Empty) (Identifier) ( - {+(Annotation - {+(Identifier)+} - {+(Error)+})+} (Annotation - (Identifier) - (Error)) + { (Identifier) + ->(Identifier) } + (SendChannel + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }))) (Annotation - (Identifier) - (Error)) - {-(Annotation - {-(Identifier)-} - {-(Error)-})-}))) + { (Identifier) + ->(Identifier) } + (SendChannel + (BiDirectionalChannel + (Constructor + (Empty))))) + (Annotation + { (Identifier) + ->(Identifier) } + (SendChannel + (ReceiveChannel + { (Identifier) + ->(Identifier) })))))) diff --git a/test/fixtures/go/channel-types.parseA.txt b/test/fixtures/go/channel-types.parseA.txt index 5b73d0815..0e7f4d5e7 100644 --- a/test/fixtures/go/channel-types.parseA.txt +++ b/test/fixtures/go/channel-types.parseA.txt @@ -7,10 +7,17 @@ ( (Annotation (Identifier) - (Error)) + (SendChannel + (BiDirectionalChannel + (Identifier)))) (Annotation (Identifier) - (Error)) + (SendChannel + (BiDirectionalChannel + (Constructor + (Empty))))) (Annotation (Identifier) - (Error))))) + (SendChannel + (ReceiveChannel + (Identifier))))))) diff --git a/test/fixtures/go/channel-types.parseB.txt b/test/fixtures/go/channel-types.parseB.txt index 5b73d0815..0e7f4d5e7 100644 --- a/test/fixtures/go/channel-types.parseB.txt +++ b/test/fixtures/go/channel-types.parseB.txt @@ -7,10 +7,17 @@ ( (Annotation (Identifier) - (Error)) + (SendChannel + (BiDirectionalChannel + (Identifier)))) (Annotation (Identifier) - (Error)) + (SendChannel + (BiDirectionalChannel + (Constructor + (Empty))))) (Annotation (Identifier) - (Error))))) + (SendChannel + (ReceiveChannel + (Identifier))))))) From a7c57ea756e320f02ebe106d822dfea658c6ee5f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 11:37:01 -0700 Subject: [PATCH 039/176] Assign aliased identifiers --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 0614617b2..9331247b1 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -176,7 +176,7 @@ typeIdentifier :: Assignment typeIdentifier = makeTerm <$> symbol TypeIdentifier <*> (Syntax.Identifier <$> source) identifier :: Assignment -identifier = makeTerm <$> symbol Identifier <*> (Syntax.Identifier <$> source) +identifier = makeTerm <$> (symbol Identifier <|> symbol Identifier') <*> (Syntax.Identifier <$> source) fieldIdentifier :: Assignment fieldIdentifier = makeTerm <$> symbol FieldIdentifier <*> (Syntax.Identifier <$> source) From 32cb5eed5655aac6d684cf63fd5b278164da0550 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 11:38:38 -0700 Subject: [PATCH 040/176] Update constructors tests --- test/fixtures/go/constructors.diffA-B.txt | 37 ++++++++++++++++++++--- test/fixtures/go/constructors.diffB-A.txt | 37 ++++++++++++++++++++--- test/fixtures/go/constructors.parseA.txt | 30 +++++++++++++++--- test/fixtures/go/constructors.parseB.txt | 30 +++++++++++++++--- 4 files changed, 118 insertions(+), 16 deletions(-) diff --git a/test/fixtures/go/constructors.diffA-B.txt b/test/fixtures/go/constructors.diffA-B.txt index 036e0af4b..0a653c743 100644 --- a/test/fixtures/go/constructors.diffA-B.txt +++ b/test/fixtures/go/constructors.diffA-B.txt @@ -5,7 +5,36 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error)))) + (Call + (Identifier) + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }) + (Minus + (Identifier) + (Identifier)) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }) + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) } + (Empty)) + (Call + (Identifier) + (Map + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty))))) diff --git a/test/fixtures/go/constructors.diffB-A.txt b/test/fixtures/go/constructors.diffB-A.txt index 036e0af4b..0a653c743 100644 --- a/test/fixtures/go/constructors.diffB-A.txt +++ b/test/fixtures/go/constructors.diffB-A.txt @@ -5,7 +5,36 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error)))) + (Call + (Identifier) + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }) + (Minus + (Identifier) + (Identifier)) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + { (Identifier) + ->(Identifier) }) + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) } + (Empty)) + (Call + (Identifier) + (Map + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty))))) diff --git a/test/fixtures/go/constructors.parseA.txt b/test/fixtures/go/constructors.parseA.txt index 036e0af4b..53e03f22b 100644 --- a/test/fixtures/go/constructors.parseA.txt +++ b/test/fixtures/go/constructors.parseA.txt @@ -5,7 +5,29 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error)))) + (Call + (Identifier) + (BiDirectionalChannel + (Identifier)) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + (Identifier)) + (Minus + (Identifier) + (Identifier)) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + (Identifier)) + (Integer) + (Integer) + (Empty)) + (Call + (Identifier) + (Map + (Identifier) + (Identifier)) + (Empty))))) diff --git a/test/fixtures/go/constructors.parseB.txt b/test/fixtures/go/constructors.parseB.txt index 036e0af4b..53e03f22b 100644 --- a/test/fixtures/go/constructors.parseB.txt +++ b/test/fixtures/go/constructors.parseB.txt @@ -5,7 +5,29 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error)))) + (Call + (Identifier) + (BiDirectionalChannel + (Identifier)) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + (Identifier)) + (Minus + (Identifier) + (Identifier)) + (Empty)) + (Call + (Identifier) + (BiDirectionalChannel + (Identifier)) + (Integer) + (Integer) + (Empty)) + (Call + (Identifier) + (Map + (Identifier) + (Identifier)) + (Empty))))) From 081b7f5ed82f94c91454eef47b0c022a43887c41 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 11:42:32 -0700 Subject: [PATCH 041/176] Assign float literals --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 9331247b1..ef71ef0a4 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -45,6 +45,7 @@ type Syntax = , Literal.Array , Literal.Channel , Literal.Composite + , Literal.Float , Literal.Hash , Literal.Integer , Literal.KeyValue @@ -107,6 +108,7 @@ expressionChoices = , fallThroughStatement , fieldDeclaration , fieldIdentifier + , floatLiteral , functionDeclaration , functionType , gotoStatement @@ -169,6 +171,9 @@ compositeLiteral = makeTerm <$> symbol CompositeLiteral <*> children (Literal.Co intLiteral :: Assignment intLiteral = makeTerm <$> symbol IntLiteral <*> (Literal.Integer <$> source) +floatLiteral :: Assignment +floatLiteral = makeTerm <$> symbol FloatLiteral <*> (Literal.Float <$> source) + rawStringLiteral :: Assignment rawStringLiteral = makeTerm <$> symbol RawStringLiteral <*> (Literal.TextElement <$> source) From 41df9b31441d9c50ae5d0b25fc878c84f37d6ac7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 11:48:03 -0700 Subject: [PATCH 042/176] Update assignment float literals tests --- test/fixtures/go/float-literals.diffA-B.txt | 25 ++++++++++++++++----- test/fixtures/go/float-literals.diffB-A.txt | 25 ++++++++++++++++----- test/fixtures/go/float-literals.parseA.txt | 20 ++++++++++++----- test/fixtures/go/float-literals.parseB.txt | 20 ++++++++++++----- 4 files changed, 70 insertions(+), 20 deletions(-) diff --git a/test/fixtures/go/float-literals.diffA-B.txt b/test/fixtures/go/float-literals.diffA-B.txt index e4d47eda0..015590ac9 100644 --- a/test/fixtures/go/float-literals.diffA-B.txt +++ b/test/fixtures/go/float-literals.diffA-B.txt @@ -5,8 +5,23 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error) - (Error)))) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) })))) diff --git a/test/fixtures/go/float-literals.diffB-A.txt b/test/fixtures/go/float-literals.diffB-A.txt index e4d47eda0..015590ac9 100644 --- a/test/fixtures/go/float-literals.diffB-A.txt +++ b/test/fixtures/go/float-literals.diffB-A.txt @@ -5,8 +5,23 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error) - (Error)))) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) }) + (Assignment + (Identifier) + { (Float) + ->(Float) })))) diff --git a/test/fixtures/go/float-literals.parseA.txt b/test/fixtures/go/float-literals.parseA.txt index e4d47eda0..aa654d8a4 100644 --- a/test/fixtures/go/float-literals.parseA.txt +++ b/test/fixtures/go/float-literals.parseA.txt @@ -5,8 +5,18 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error) - (Error)))) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float))))) diff --git a/test/fixtures/go/float-literals.parseB.txt b/test/fixtures/go/float-literals.parseB.txt index e4d47eda0..aa654d8a4 100644 --- a/test/fixtures/go/float-literals.parseB.txt +++ b/test/fixtures/go/float-literals.parseB.txt @@ -5,8 +5,18 @@ (Empty) (Identifier) ( - (Error) - (Error) - (Error) - (Error) - (Error)))) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float)) + (Assignment + (Identifier) + (Float))))) From 6774730e4881d1422aa333b01b4750358c16e5f5 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 14:02:21 -0700 Subject: [PATCH 043/176] Assign continue statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ef71ef0a4..428aede05 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -52,6 +52,7 @@ type Syntax = , Literal.TextElement , Statement.Assignment , Statement.Break + , Statement.Continue , Statement.Goto , Statement.If , Statement.Match @@ -97,6 +98,7 @@ expressionChoices = , channelType , comment , compositeLiteral + , continueStatement , varDeclaration , varSpecification , decStatement @@ -430,6 +432,9 @@ shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Stat breakStatement :: Assignment breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (labelName <|> emptyTerm)) +continueStatement :: Assignment +continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (labelName <|> emptyTerm)) + decStatement :: Assignment decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression) From c55ce3243e0632eed1b50085b93ceb319aa1c7ea Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 15:21:26 -0700 Subject: [PATCH 044/176] Add additional for range clause examples --- test/fixtures/go/for-statements.A.go | 7 +++++++ test/fixtures/go/for-statements.B.go | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/test/fixtures/go/for-statements.A.go b/test/fixtures/go/for-statements.A.go index 66e5f7a4c..fd1d92790 100644 --- a/test/fixtures/go/for-statements.A.go +++ b/test/fixtures/go/for-statements.A.go @@ -21,4 +21,11 @@ for x := range y { a(x) break } +for i, s := range a { + g(i, s) +} +for key, val = range m { + h(key, val) +} +for range ch {} } diff --git a/test/fixtures/go/for-statements.B.go b/test/fixtures/go/for-statements.B.go index 4099658cb..3a427a0dd 100644 --- a/test/fixtures/go/for-statements.B.go +++ b/test/fixtures/go/for-statements.B.go @@ -21,4 +21,11 @@ for { a(x) break } +for s, i := range b { + g(i, s) +} +for k, v = range m { + h(k, v) +} +for range b {} } From adc0d4cfe97e603d2f2d4e642419231568c530aa Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 15:22:03 -0700 Subject: [PATCH 045/176] Assign for statements :ghost: :japanese_goblin: --- src/Language/Go/Assignment.hs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 428aede05..db9473228 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DataKinds, DeriveAnyClass, RankNTypes, TypeOperators #-} +{-# LANGUAGE DataKinds, DeriveAnyClass, RankNTypes, TupleSections, TypeOperators #-} module Language.Go.Assignment ( assignment , Syntax @@ -53,6 +53,8 @@ type Syntax = , Statement.Assignment , Statement.Break , Statement.Continue + , Statement.For + , Statement.ForEach , Statement.Goto , Statement.If , Statement.Match @@ -111,6 +113,7 @@ expressionChoices = , fieldDeclaration , fieldIdentifier , floatLiteral + , forStatement , functionDeclaration , functionType , gotoStatement @@ -450,6 +453,20 @@ ifInitializer = symbol IfInitializer *> children expression elseClause :: Assignment elseClause = symbol ElseClause *> children expression +forStatement :: Assignment +forStatement = mkForStatement <$> symbol ForStatement <*> children ((,) <$> (forClause <|> rangeClause <|> emptyClause) <*> expression) + where + mkForStatement loc ((constructor, a, b, c), block') = case (constructor :: [Char]) of + "forEach" -> makeTerm loc $ (Statement.ForEach a b block') + _ -> makeTerm loc $ (Statement.For a b c block') + emptyClause = children (("for",,,) <$> emptyTerm <*> emptyTerm <*> emptyTerm) + rangeClause = symbol RangeClause *> children ( (("forEach",,,) <$> expression <*> expression <*> emptyTerm) + <|> (("forEach",,,) <$> emptyTerm <*> expression <*> emptyTerm)) + forClause = symbol ForClause *> children ( (("for",,,) <$> expression <*> expression <*> expression) + <|> (("for",,,) <$> expression <*> expression <*> emptyTerm) + <|> (("for",,,) <$> expression <*> emptyTerm <*> emptyTerm) + <|> (("for",,,) <$> emptyTerm <*> emptyTerm <*> emptyTerm)) + incStatement :: Assignment incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression) From 8164e9b2de15e9d3a9cf657e1b3fb7fd3c4999d7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:14:55 -0700 Subject: [PATCH 046/176] Update for-statement tests --- test/fixtures/go/for-statements.diffA-B.txt | 149 +++++++++++++++++++- test/fixtures/go/for-statements.diffB-A.txt | 146 ++++++++++++++++++- test/fixtures/go/for-statements.parseA.txt | 87 +++++++++++- test/fixtures/go/for-statements.parseB.txt | 82 ++++++++++- 4 files changed, 460 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/for-statements.diffA-B.txt b/test/fixtures/go/for-statements.diffA-B.txt index e31b62159..5be234393 100644 --- a/test/fixtures/go/for-statements.diffA-B.txt +++ b/test/fixtures/go/for-statements.diffA-B.txt @@ -1,4 +1,151 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Goto + (Identifier)))) + {+(ForEach + {+(Identifier)+} + {+(Identifier)+} + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Break + {+(Identifier)+})+})+})+} + {+(For + {+(Empty)+} + {+(Empty)+} + {+(Empty)+} + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Continue + {+(Identifier)+})+})+})+} + (For + { (Assignment + {-(Identifier)-} + {-(Integer)-}) + ->(LessThan + {+(Identifier)+} + {+(Integer)+}) } + { (LessThan + {-(Identifier)-} + {-(Integer)-}) + ->(PostIncrement + {+(Identifier)+}) } + { (PostIncrement + {-(Identifier)-}) + ->(Empty) } + ( + (Call + (Identifier) + (Empty)) + {+(Continue + {+(Empty)+})+} + {-(Break + {-(Identifier)-})-})) + {+(For + {+(Empty)+} + {+(Empty)+} + {+(Empty)+} + {+( + {+(Call + {+(Identifier)+} + {+(Identifier)+} + {+(Empty)+})+} + {+(Break + {+(Empty)+})+})+})+} + {+(ForEach + {+( + {+(Identifier)+} + {+(Identifier)+})+} + {+(Identifier)+} + {+(Call + {+(Identifier)+} + {+(Identifier)+} + {+(Identifier)+} + {+(Empty)+})+})+} + {+(ForEach + {+( + {+(Identifier)+} + {+(Identifier)+})+} + {+(Identifier)+} + {+(Call + {+(Identifier)+} + {+(Identifier)+} + {+(Identifier)+} + {+(Empty)+})+})+} + {+(ForEach + {+(Empty)+} + {+(Identifier)+} + {+([])+})+} + {-(For + {-(LessThan + {-(Identifier)-} + {-(Integer)-})-} + {-(PostIncrement + {-(Identifier)-})-} + {-(Empty)-} + {-( + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Continue + {-(Identifier)-})-})-})-} + {-(For + {-(Empty)-} + {-(Empty)-} + {-(Empty)-} + {-( + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Continue + {-(Empty)-})-})-})-} + {-(ForEach + {-(Identifier)-} + {-(Identifier)-} + {-( + {-(Call + {-(Identifier)-} + {-(Identifier)-} + {-(Empty)-})-} + {-(Break + {-(Empty)-})-})-})-} + {-(ForEach + {-( + {-(Identifier)-} + {-(Identifier)-})-} + {-(Identifier)-} + {-(Call + {-(Identifier)-} + {-(Identifier)-} + {-(Identifier)-} + {-(Empty)-})-})-} + {-(ForEach + {-( + {-(Identifier)-} + {-(Identifier)-})-} + {-(Identifier)-} + {-(Call + {-(Identifier)-} + {-(Identifier)-} + {-(Identifier)-} + {-(Empty)-})-})-} + {-(ForEach + {-(Empty)-} + {-(Identifier)-} + {-([])-})-}))) diff --git a/test/fixtures/go/for-statements.diffB-A.txt b/test/fixtures/go/for-statements.diffB-A.txt index e31b62159..6f4b2c152 100644 --- a/test/fixtures/go/for-statements.diffB-A.txt +++ b/test/fixtures/go/for-statements.diffB-A.txt @@ -1,4 +1,148 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Goto + (Identifier)))) + {+(For + {+(Assignment + {+(Identifier)+} + {+(Integer)+})+} + {+(LessThan + {+(Identifier)+} + {+(Integer)+})+} + {+(PostIncrement + {+(Identifier)+})+} + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Break + {+(Identifier)+})+})+})+} + {+(For + {+(LessThan + {+(Identifier)+} + {+(Integer)+})+} + {+(PostIncrement + {+(Identifier)+})+} + {+(Empty)+} + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Continue + {+(Identifier)+})+})+})+} + {+(For + {+(Empty)+} + {+(Empty)+} + {+(Empty)+} + {+( + {+(Call + {+(Identifier)+} + {+(Empty)+})+} + {+(Continue + {+(Empty)+})+})+})+} + (ForEach + (Identifier) + (Identifier) + ( + (Call + (Identifier) + {+(Identifier)+} + (Empty)) + (Break + { (Identifier) + ->(Empty) }))) + {+(ForEach + {+( + {+(Identifier)+} + {+(Identifier)+})+} + {+(Identifier)+} + {+(Call + {+(Identifier)+} + {+(Identifier)+} + {+(Identifier)+} + {+(Empty)+})+})+} + {+(ForEach + {+( + {+(Identifier)+} + {+(Identifier)+})+} + {+(Identifier)+} + {+(Call + {+(Identifier)+} + {+(Identifier)+} + {+(Identifier)+} + {+(Empty)+})+})+} + {+(ForEach + {+(Empty)+} + {+(Identifier)+} + {+([])+})+} + {-(For + {-(Empty)-} + {-(Empty)-} + {-(Empty)-} + {-( + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Continue + {-(Identifier)-})-})-})-} + {-(For + {-(LessThan + {-(Identifier)-} + {-(Integer)-})-} + {-(PostIncrement + {-(Identifier)-})-} + {-(Empty)-} + {-( + {-(Call + {-(Identifier)-} + {-(Empty)-})-} + {-(Continue + {-(Empty)-})-})-})-} + {-(For + {-(Empty)-} + {-(Empty)-} + {-(Empty)-} + {-( + {-(Call + {-(Identifier)-} + {-(Identifier)-} + {-(Empty)-})-} + {-(Break + {-(Empty)-})-})-})-} + {-(ForEach + {-( + {-(Identifier)-} + {-(Identifier)-})-} + {-(Identifier)-} + {-(Call + {-(Identifier)-} + {-(Identifier)-} + {-(Identifier)-} + {-(Empty)-})-})-} + {-(ForEach + {-( + {-(Identifier)-} + {-(Identifier)-})-} + {-(Identifier)-} + {-(Call + {-(Identifier)-} + {-(Identifier)-} + {-(Identifier)-} + {-(Empty)-})-})-} + {-(ForEach + {-(Empty)-} + {-(Identifier)-} + {-([])-})-}))) diff --git a/test/fixtures/go/for-statements.parseA.txt b/test/fixtures/go/for-statements.parseA.txt index e31b62159..e80cd9800 100644 --- a/test/fixtures/go/for-statements.parseA.txt +++ b/test/fixtures/go/for-statements.parseA.txt @@ -1,4 +1,89 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Goto + (Identifier)))) + (For + (Assignment + (Identifier) + (Integer)) + (LessThan + (Identifier) + (Integer)) + (PostIncrement + (Identifier)) + ( + (Call + (Identifier) + (Empty)) + (Break + (Identifier)))) + (For + (LessThan + (Identifier) + (Integer)) + (PostIncrement + (Identifier)) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Continue + (Identifier)))) + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Continue + (Empty)))) + (ForEach + (Identifier) + (Identifier) + ( + (Call + (Identifier) + (Identifier) + (Empty)) + (Break + (Empty)))) + (ForEach + ( + (Identifier) + (Identifier)) + (Identifier) + (Call + (Identifier) + (Identifier) + (Identifier) + (Empty))) + (ForEach + ( + (Identifier) + (Identifier)) + (Identifier) + (Call + (Identifier) + (Identifier) + (Identifier) + (Empty))) + (ForEach + (Empty) + (Identifier) + ([]))))) diff --git a/test/fixtures/go/for-statements.parseB.txt b/test/fixtures/go/for-statements.parseB.txt index e31b62159..a52cd0cee 100644 --- a/test/fixtures/go/for-statements.parseB.txt +++ b/test/fixtures/go/for-statements.parseB.txt @@ -1,4 +1,84 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Goto + (Identifier)))) + (ForEach + (Identifier) + (Identifier) + ( + (Call + (Identifier) + (Empty)) + (Break + (Identifier)))) + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Continue + (Identifier)))) + (For + (LessThan + (Identifier) + (Integer)) + (PostIncrement + (Identifier)) + (Empty) + ( + (Call + (Identifier) + (Empty)) + (Continue + (Empty)))) + (For + (Empty) + (Empty) + (Empty) + ( + (Call + (Identifier) + (Identifier) + (Empty)) + (Break + (Empty)))) + (ForEach + ( + (Identifier) + (Identifier)) + (Identifier) + (Call + (Identifier) + (Identifier) + (Identifier) + (Empty))) + (ForEach + ( + (Identifier) + (Identifier)) + (Identifier) + (Call + (Identifier) + (Identifier) + (Identifier) + (Empty))) + (ForEach + (Empty) + (Identifier) + ([]))))) From d48f2253e5dbe82bc2e0175e0f8a71eb2926045d Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:28:59 -0700 Subject: [PATCH 047/176] Use newtype --- src/Language/Go/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 9c00f694d..333fc53a1 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -18,7 +18,7 @@ instance Ord1 Variadic where liftCompare = genericLiftCompare instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec -- | A pattern in a pattern-matching or computed jump control-flow statement, like 'case' in C or JavaScript, 'when' in Ruby, or the left-hand side of '->' in the body of Haskell 'case' expressions. -data DefaultPattern a = DefaultPattern { patternBody :: !a } +newtype DefaultPattern a = DefaultPattern { patternBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 DefaultPattern where liftEq = genericLiftEq From 6bd1ca16833b65ed81ac56f60ac21f56fb6ff33c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:45:34 -0700 Subject: [PATCH 048/176] Update field name --- src/Language/Go/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 333fc53a1..9aaac08c6 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -18,7 +18,7 @@ instance Ord1 Variadic where liftCompare = genericLiftCompare instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec -- | A pattern in a pattern-matching or computed jump control-flow statement, like 'case' in C or JavaScript, 'when' in Ruby, or the left-hand side of '->' in the body of Haskell 'case' expressions. -newtype DefaultPattern a = DefaultPattern { patternBody :: a } +newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 DefaultPattern where liftEq = genericLiftEq From cca7590d37b4389dd90c404400b76877eda26a4e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:45:45 -0700 Subject: [PATCH 049/176] Add RuneLiteral constructor --- src/Language/Go/Syntax.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 9aaac08c6..5c8805313 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -3,6 +3,7 @@ module Language.Go.Syntax where import Algorithm import Data.Align.Generic +import Data.ByteString (ByteString) import Data.Functor.Classes.Eq.Generic import Data.Functor.Classes.Ord.Generic import Data.Functor.Classes.Show.Generic @@ -24,3 +25,11 @@ newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a } instance Eq1 DefaultPattern where liftEq = genericLiftEq instance Ord1 DefaultPattern where liftCompare = genericLiftCompare instance Show1 DefaultPattern where liftShowsPrec = genericLiftShowsPrec + +-- | A rune literal in Go (e.g. '⌘') +newtype RuneLiteral a = RuneLiteral { runeLiteralContent :: ByteString } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 RuneLiteral where liftEq = genericLiftEq +instance Ord1 RuneLiteral where liftCompare = genericLiftCompare +instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec From 2373aa1a62bf4e24745e2e196ac5aea87172f8ce Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:45:55 -0700 Subject: [PATCH 050/176] Assign rune literals --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index db9473228..f3dc08feb 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -41,6 +41,7 @@ type Syntax = , Statement.PostIncrement , Expression.MemberAccess , Go.Syntax.DefaultPattern + , Go.Syntax.RuneLiteral , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -141,6 +142,7 @@ expressionChoices = , pointerType , rawStringLiteral , returnStatement + , runeLiteral , shortVarDeclaration , sliceType , structType @@ -203,6 +205,9 @@ interpretedStringLiteral = makeTerm <$> symbol InterpretedStringLiteral <*> (Lit comment :: Assignment comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) +runeLiteral :: Assignment +runeLiteral = makeTerm <$> symbol Grammar.RuneLiteral <*> (Go.Syntax.RuneLiteral <$> source) + -- Primitive Types From 22bede548b9d765b8eaab980e0629ff97f2b00ab Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:46:06 -0700 Subject: [PATCH 051/176] Update rune literal tests --- test/fixtures/go/rune-literals.diffA-B.txt | 18 ++++++++++++------ test/fixtures/go/rune-literals.diffB-A.txt | 18 ++++++++++++------ test/fixtures/go/rune-literals.parseA.txt | 12 ++++++------ test/fixtures/go/rune-literals.parseB.txt | 12 ++++++------ 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/test/fixtures/go/rune-literals.diffA-B.txt b/test/fixtures/go/rune-literals.diffA-B.txt index df5b35cca..fdaad27e5 100644 --- a/test/fixtures/go/rune-literals.diffA-B.txt +++ b/test/fixtures/go/rune-literals.diffA-B.txt @@ -4,19 +4,25 @@ ( (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)))) + { (RuneLiteral) + ->(RuneLiteral) }))) diff --git a/test/fixtures/go/rune-literals.diffB-A.txt b/test/fixtures/go/rune-literals.diffB-A.txt index df5b35cca..fdaad27e5 100644 --- a/test/fixtures/go/rune-literals.diffB-A.txt +++ b/test/fixtures/go/rune-literals.diffB-A.txt @@ -4,19 +4,25 @@ ( (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)) + { (RuneLiteral) + ->(RuneLiteral) }) (Assignment (Identifier) - (Error)))) + { (RuneLiteral) + ->(RuneLiteral) }))) diff --git a/test/fixtures/go/rune-literals.parseA.txt b/test/fixtures/go/rune-literals.parseA.txt index df5b35cca..e00a77c51 100644 --- a/test/fixtures/go/rune-literals.parseA.txt +++ b/test/fixtures/go/rune-literals.parseA.txt @@ -4,19 +4,19 @@ ( (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)))) + (RuneLiteral)))) diff --git a/test/fixtures/go/rune-literals.parseB.txt b/test/fixtures/go/rune-literals.parseB.txt index df5b35cca..e00a77c51 100644 --- a/test/fixtures/go/rune-literals.parseB.txt +++ b/test/fixtures/go/rune-literals.parseB.txt @@ -4,19 +4,19 @@ ( (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)) + (RuneLiteral)) (Assignment (Identifier) - (Error)))) + (RuneLiteral)))) From 3572eef3f506613c0340782d4b5627ee218832b7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:56:59 -0700 Subject: [PATCH 052/176] Assign selector expressions --- src/Language/Go/Assignment.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index f3dc08feb..3d44a6427 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -143,6 +143,7 @@ expressionChoices = , rawStringLiteral , returnStatement , runeLiteral + , selectorExpression , shortVarDeclaration , sliceType , structType @@ -298,6 +299,9 @@ typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children parenthesizedExpression :: Assignment parenthesizedExpression = symbol ParenthesizedExpression *> children expressions +selectorExpression :: Assignment +selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expression.MemberAccess <$> expression <*> expression) + unaryExpression :: Assignment unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) @@ -353,7 +357,7 @@ variadicArgument :: Assignment variadicArgument = makeTerm <$> symbol VariadicArgument <*> children (Go.Syntax.Variadic <$> pure [] <*> expression) callExpression :: Assignment -callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> identifier <*> many expression <*> emptyTerm) +callExpression = makeTerm <$> symbol CallExpression <*> children (Expression.Call <$> pure [] <*> expression <*> many expression <*> emptyTerm) varDeclaration :: Assignment varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions From 60d52118a8d8b4215451df039e013b860639fef8 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 16:59:01 -0700 Subject: [PATCH 053/176] Update selector expressions tests --- test/fixtures/go/selector-expressions.diffA-B.txt | 11 ++++++++++- test/fixtures/go/selector-expressions.diffB-A.txt | 11 ++++++++++- test/fixtures/go/selector-expressions.parseA.txt | 8 +++++++- test/fixtures/go/selector-expressions.parseB.txt | 8 +++++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/selector-expressions.diffA-B.txt b/test/fixtures/go/selector-expressions.diffA-B.txt index 3be354ac0..f69991019 100644 --- a/test/fixtures/go/selector-expressions.diffA-B.txt +++ b/test/fixtures/go/selector-expressions.diffA-B.txt @@ -4,4 +4,13 @@ (Function (Empty) (Identifier) - (Error))) + (Call + (MemberAccess + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) }) + (Empty)))) diff --git a/test/fixtures/go/selector-expressions.diffB-A.txt b/test/fixtures/go/selector-expressions.diffB-A.txt index 3be354ac0..f69991019 100644 --- a/test/fixtures/go/selector-expressions.diffB-A.txt +++ b/test/fixtures/go/selector-expressions.diffB-A.txt @@ -4,4 +4,13 @@ (Function (Empty) (Identifier) - (Error))) + (Call + (MemberAccess + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) }) + (Empty)))) diff --git a/test/fixtures/go/selector-expressions.parseA.txt b/test/fixtures/go/selector-expressions.parseA.txt index 3be354ac0..250364338 100644 --- a/test/fixtures/go/selector-expressions.parseA.txt +++ b/test/fixtures/go/selector-expressions.parseA.txt @@ -4,4 +4,10 @@ (Function (Empty) (Identifier) - (Error))) + (Call + (MemberAccess + (MemberAccess + (Identifier) + (Identifier)) + (Identifier)) + (Empty)))) diff --git a/test/fixtures/go/selector-expressions.parseB.txt b/test/fixtures/go/selector-expressions.parseB.txt index 3be354ac0..250364338 100644 --- a/test/fixtures/go/selector-expressions.parseB.txt +++ b/test/fixtures/go/selector-expressions.parseB.txt @@ -4,4 +4,10 @@ (Function (Empty) (Identifier) - (Error))) + (Call + (MemberAccess + (MemberAccess + (Identifier) + (Identifier)) + (Identifier)) + (Empty)))) From 6ce21449d01f471ea238f0bef25cbe532f1695f3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:10:10 -0700 Subject: [PATCH 054/176] Add Label constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 5c8805313..b66027a4c 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -33,3 +33,11 @@ newtype RuneLiteral a = RuneLiteral { runeLiteralContent :: ByteString } instance Eq1 RuneLiteral where liftEq = genericLiftEq instance Ord1 RuneLiteral where liftCompare = genericLiftCompare instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec + +-- | A labeled statement in Go (e.g. a:continue) +data Label a = Label { labelName :: a, labelStatement :: a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Label where liftEq = genericLiftEq +instance Ord1 Label where liftCompare = genericLiftCompare +instance Show1 Label where liftShowsPrec = genericLiftShowsPrec From 9d97e84ae6c3eb8b01f8d6e1b6221489935a96bc Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:10:27 -0700 Subject: [PATCH 055/176] Assign label statements --- src/Language/Go/Assignment.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 3d44a6427..d27fff6a7 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -41,6 +41,7 @@ type Syntax = , Statement.PostIncrement , Expression.MemberAccess , Go.Syntax.DefaultPattern + , Go.Syntax.Label , Go.Syntax.RuneLiteral , Go.Syntax.Variadic , Literal.Array @@ -129,7 +130,8 @@ expressionChoices = , interpretedStringLiteral , intLiteral , keyedElement - , labelName + , labelName' + , labelStatement' , literalValue , mapType , methodDeclaration @@ -442,10 +444,10 @@ shortVarDeclaration :: Assignment shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment <$> pure [] <*> expression <*> expression) breakStatement :: Assignment -breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (labelName <|> emptyTerm)) +breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (labelName' <|> emptyTerm)) continueStatement :: Assignment -continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (labelName <|> emptyTerm)) +continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statement.Continue <$> (labelName' <|> emptyTerm)) decStatement :: Assignment decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression) @@ -482,8 +484,11 @@ incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncr keyedElement :: Assignment keyedElement = makeTerm <$> symbol KeyedElement <*> children (Literal.KeyValue <$> expression <*> expression) -labelName :: Assignment -labelName = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source) +labelName' :: Assignment +labelName' = makeTerm <$> symbol LabelName <*> (Syntax.Identifier <$> source) + +labelStatement' :: Assignment +labelStatement' = makeTerm <$> symbol LabelStatement <*> children (Go.Syntax.Label <$> expression <*> (expression <|> emptyTerm)) returnStatement :: Assignment returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (expression <|> emptyTerm)) From a52fd8de2a5aaf9c11fb3d138163cb5ac1d1fb47 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:18:33 -0700 Subject: [PATCH 056/176] Update label statements tests --- test/fixtures/go/label-statements.diffA-B.txt | 5 ++++- test/fixtures/go/label-statements.diffB-A.txt | 5 ++++- test/fixtures/go/label-statements.parseA.txt | 4 +++- test/fixtures/go/label-statements.parseB.txt | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/label-statements.diffA-B.txt b/test/fixtures/go/label-statements.diffA-B.txt index 3be354ac0..5138230cd 100644 --- a/test/fixtures/go/label-statements.diffA-B.txt +++ b/test/fixtures/go/label-statements.diffA-B.txt @@ -4,4 +4,7 @@ (Function (Empty) (Identifier) - (Error))) + (Label + { (Identifier) + ->(Identifier) } + (Empty)))) diff --git a/test/fixtures/go/label-statements.diffB-A.txt b/test/fixtures/go/label-statements.diffB-A.txt index 3be354ac0..5138230cd 100644 --- a/test/fixtures/go/label-statements.diffB-A.txt +++ b/test/fixtures/go/label-statements.diffB-A.txt @@ -4,4 +4,7 @@ (Function (Empty) (Identifier) - (Error))) + (Label + { (Identifier) + ->(Identifier) } + (Empty)))) diff --git a/test/fixtures/go/label-statements.parseA.txt b/test/fixtures/go/label-statements.parseA.txt index 3be354ac0..d802b6743 100644 --- a/test/fixtures/go/label-statements.parseA.txt +++ b/test/fixtures/go/label-statements.parseA.txt @@ -4,4 +4,6 @@ (Function (Empty) (Identifier) - (Error))) + (Label + (Identifier) + (Empty)))) diff --git a/test/fixtures/go/label-statements.parseB.txt b/test/fixtures/go/label-statements.parseB.txt index 3be354ac0..d802b6743 100644 --- a/test/fixtures/go/label-statements.parseB.txt +++ b/test/fixtures/go/label-statements.parseB.txt @@ -4,4 +4,6 @@ (Function (Empty) (Identifier) - (Error))) + (Label + (Identifier) + (Empty)))) From fd7a99cfc361795bf02d68f5da3fdbc464825e3e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:18:42 -0700 Subject: [PATCH 057/176] Assign imaginary literals --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index d27fff6a7..39566a57a 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -46,6 +46,7 @@ type Syntax = , Go.Syntax.Variadic , Literal.Array , Literal.Channel + , Literal.Complex , Literal.Composite , Literal.Float , Literal.Hash @@ -121,6 +122,7 @@ expressionChoices = , gotoStatement , ifInitializer , ifStatement + , imaginaryLiteral , incStatement , identifier , implicitLengthArrayType @@ -172,6 +174,9 @@ expressions = mk <$> location <*> many expression element :: Assignment element = symbol Element *> children expression +imaginaryLiteral :: Assignment +imaginaryLiteral = makeTerm <$> symbol ImaginaryLiteral <*> (Literal.Complex <$> source) + literalValue :: Assignment literalValue = makeTerm <$> symbol LiteralValue <*> children (many expression) From d2e53d30aa8156bf06c7db68b8ea853fde2b4f8a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:23:15 -0700 Subject: [PATCH 058/176] Add Send constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index b66027a4c..12f639a36 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -41,3 +41,11 @@ data Label a = Label { labelName :: a, labelStatement :: a } instance Eq1 Label where liftEq = genericLiftEq instance Ord1 Label where liftCompare = genericLiftCompare instance Show1 Label where liftShowsPrec = genericLiftShowsPrec + +-- | A send statement in Go (e.g. chan <- value) +data Send a = Send { sendReceiver :: a, sendValue :: a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Send where liftEq = genericLiftEq +instance Ord1 Send where liftCompare = genericLiftCompare +instance Show1 Send where liftShowsPrec = genericLiftShowsPrec From a3832c996f349fb3361fc23df9490377f8d18bcd Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:23:24 -0700 Subject: [PATCH 059/176] Assign send statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 39566a57a..6bf9cc4ed 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -43,6 +43,7 @@ type Syntax = , Go.Syntax.DefaultPattern , Go.Syntax.Label , Go.Syntax.RuneLiteral + , Go.Syntax.Send , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -148,6 +149,7 @@ expressionChoices = , returnStatement , runeLiteral , selectorExpression + , sendStatement , shortVarDeclaration , sliceType , structType @@ -448,6 +450,9 @@ assignment' = makeTerm' <$> symbol AssignmentStatement <*> children (infixTerm shortVarDeclaration :: Assignment shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment <$> pure [] <*> expression <*> expression) +sendStatement :: Assignment +sendStatement = makeTerm <$> symbol SendStatement <*> children (Go.Syntax.Send <$> expression <*> expression) + breakStatement :: Assignment breakStatement = makeTerm <$> symbol BreakStatement <*> children (Statement.Break <$> (labelName' <|> emptyTerm)) From 81ed903aae81ca8e53bc9cfa9adf31c66c03bf7d Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:24:29 -0700 Subject: [PATCH 060/176] Update imaginary literals tests --- test/fixtures/go/imaginary-literals.diffA-B.txt | 6 ++++-- test/fixtures/go/imaginary-literals.diffB-A.txt | 6 ++++-- test/fixtures/go/imaginary-literals.parseA.txt | 4 ++-- test/fixtures/go/imaginary-literals.parseB.txt | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/imaginary-literals.diffA-B.txt b/test/fixtures/go/imaginary-literals.diffA-B.txt index c99e29f9f..0955b26ce 100644 --- a/test/fixtures/go/imaginary-literals.diffA-B.txt +++ b/test/fixtures/go/imaginary-literals.diffA-B.txt @@ -7,7 +7,9 @@ ( (Assignment (Identifier) - (Error)) + { (Complex) + ->(Complex) }) (Assignment (Identifier) - (Error))))) + { (Complex) + ->(Complex) })))) diff --git a/test/fixtures/go/imaginary-literals.diffB-A.txt b/test/fixtures/go/imaginary-literals.diffB-A.txt index c99e29f9f..0955b26ce 100644 --- a/test/fixtures/go/imaginary-literals.diffB-A.txt +++ b/test/fixtures/go/imaginary-literals.diffB-A.txt @@ -7,7 +7,9 @@ ( (Assignment (Identifier) - (Error)) + { (Complex) + ->(Complex) }) (Assignment (Identifier) - (Error))))) + { (Complex) + ->(Complex) })))) diff --git a/test/fixtures/go/imaginary-literals.parseA.txt b/test/fixtures/go/imaginary-literals.parseA.txt index c99e29f9f..994f26f14 100644 --- a/test/fixtures/go/imaginary-literals.parseA.txt +++ b/test/fixtures/go/imaginary-literals.parseA.txt @@ -7,7 +7,7 @@ ( (Assignment (Identifier) - (Error)) + (Complex)) (Assignment (Identifier) - (Error))))) + (Complex))))) diff --git a/test/fixtures/go/imaginary-literals.parseB.txt b/test/fixtures/go/imaginary-literals.parseB.txt index c99e29f9f..994f26f14 100644 --- a/test/fixtures/go/imaginary-literals.parseB.txt +++ b/test/fixtures/go/imaginary-literals.parseB.txt @@ -7,7 +7,7 @@ ( (Assignment (Identifier) - (Error)) + (Complex)) (Assignment (Identifier) - (Error))))) + (Complex))))) From 46ee009d74e2990428ac436943c33e3c72663cd2 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 17:28:15 -0700 Subject: [PATCH 061/176] Update send statements tests --- test/fixtures/go/send-statements.diffA-B.txt | 9 ++++++++- test/fixtures/go/send-statements.diffB-A.txt | 9 ++++++++- test/fixtures/go/send-statements.parseA.txt | 7 ++++++- test/fixtures/go/send-statements.parseB.txt | 7 ++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/send-statements.diffA-B.txt b/test/fixtures/go/send-statements.diffA-B.txt index e31b62159..24ca88623 100644 --- a/test/fixtures/go/send-statements.diffA-B.txt +++ b/test/fixtures/go/send-statements.diffA-B.txt @@ -1,4 +1,11 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Send + { (Identifier) + ->(Identifier) } + { (Integer) + ->(Integer) }))) diff --git a/test/fixtures/go/send-statements.diffB-A.txt b/test/fixtures/go/send-statements.diffB-A.txt index e31b62159..24ca88623 100644 --- a/test/fixtures/go/send-statements.diffB-A.txt +++ b/test/fixtures/go/send-statements.diffB-A.txt @@ -1,4 +1,11 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Send + { (Identifier) + ->(Identifier) } + { (Integer) + ->(Integer) }))) diff --git a/test/fixtures/go/send-statements.parseA.txt b/test/fixtures/go/send-statements.parseA.txt index e31b62159..3c3901a4c 100644 --- a/test/fixtures/go/send-statements.parseA.txt +++ b/test/fixtures/go/send-statements.parseA.txt @@ -1,4 +1,9 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Send + (Identifier) + (Integer)))) diff --git a/test/fixtures/go/send-statements.parseB.txt b/test/fixtures/go/send-statements.parseB.txt index e31b62159..3c3901a4c 100644 --- a/test/fixtures/go/send-statements.parseB.txt +++ b/test/fixtures/go/send-statements.parseB.txt @@ -1,4 +1,9 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Send + (Identifier) + (Integer)))) From f1cc87228541234af1a46e3cdcee37523526eee7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 31 Oct 2017 23:07:57 -0700 Subject: [PATCH 062/176] Update :memo: --- src/Language/Go/Syntax.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 12f639a36..b0bf52683 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -10,7 +10,7 @@ import Data.Functor.Classes.Show.Generic import Data.Mergeable import GHC.Generics --- | Variadic (`...Type` used in function declarations, and `Type...` used in function calls). +-- | Variadic arguments and parameters in Go (e.g. parameter: `param ...Type`, argument: `Type...`). data Variadic a = Variadic { variadicContext :: [a], variadicIdentifier :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -18,7 +18,7 @@ instance Eq1 Variadic where liftEq = genericLiftEq instance Ord1 Variadic where liftCompare = genericLiftCompare instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec --- | A pattern in a pattern-matching or computed jump control-flow statement, like 'case' in C or JavaScript, 'when' in Ruby, or the left-hand side of '->' in the body of Haskell 'case' expressions. +-- | A default pattern in a Go case statement (e.g. `switch { default: s() }`). newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -34,7 +34,7 @@ instance Eq1 RuneLiteral where liftEq = genericLiftEq instance Ord1 RuneLiteral where liftCompare = genericLiftCompare instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec --- | A labeled statement in Go (e.g. a:continue) +-- | A labeled statement in Go (e.g. label:continue) data Label a = Label { labelName :: a, labelStatement :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -42,7 +42,7 @@ instance Eq1 Label where liftEq = genericLiftEq instance Ord1 Label where liftCompare = genericLiftCompare instance Show1 Label where liftShowsPrec = genericLiftShowsPrec --- | A send statement in Go (e.g. chan <- value) +-- | A send statement in Go (e.g. channel <- value). data Send a = Send { sendReceiver :: a, sendValue :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From b6e281a0aa7b0809365f260939d1a48069a2178a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 10:48:05 -0700 Subject: [PATCH 063/176] Assign function declarations whose return type is a list of parameters --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 6bf9cc4ed..ea6cd31a3 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -385,9 +385,10 @@ expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment -functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> emptyTerm) <*> block) +functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> parameters' <|> emptyTerm) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') parameters = symbol Parameters *> children (many expression) + parameters' = makeTerm <$> symbol Parameters <*> children (many expression) variadicParameterDeclaration :: Assignment variadicParameterDeclaration = mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> emptyTerm <*> expression) From 58ac8e5ad85ec564077390666ae6374518f892f8 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 10:49:45 -0700 Subject: [PATCH 064/176] Use more descriptive name --- src/Language/Go/Assignment.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ea6cd31a3..ca01caa76 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -385,10 +385,10 @@ expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment -functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> parameters' <|> emptyTerm) <*> block) +functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') parameters = symbol Parameters *> children (many expression) - parameters' = makeTerm <$> symbol Parameters <*> children (many expression) + returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) variadicParameterDeclaration :: Assignment variadicParameterDeclaration = mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> emptyTerm <*> expression) From da8d8b8214e12418f49645324b49d75c1c6d2ab0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 11:00:09 -0700 Subject: [PATCH 065/176] Update function declaration tests --- .../go/function-declarations.diffA-B.txt | 20 +++++++++++++++++-- .../go/function-declarations.diffB-A.txt | 20 +++++++++++++++++-- .../go/function-declarations.parseA.txt | 18 +++++++++++++++-- .../go/function-declarations.parseB.txt | 18 +++++++++++++++-- 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/function-declarations.diffA-B.txt b/test/fixtures/go/function-declarations.diffA-B.txt index 25aebac20..c362c5815 100644 --- a/test/fixtures/go/function-declarations.diffA-B.txt +++ b/test/fixtures/go/function-declarations.diffA-B.txt @@ -23,5 +23,21 @@ (Identifier) (Identifier)) ([])) - (Error) - (Error)) + (Function + ( + (Identifier) + (Identifier)) + { (Identifier) + ->(Identifier) } + ([])) + (Function + ( + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier))) + { (Identifier) + ->(Identifier) } + ([]))) diff --git a/test/fixtures/go/function-declarations.diffB-A.txt b/test/fixtures/go/function-declarations.diffB-A.txt index 25aebac20..c362c5815 100644 --- a/test/fixtures/go/function-declarations.diffB-A.txt +++ b/test/fixtures/go/function-declarations.diffB-A.txt @@ -23,5 +23,21 @@ (Identifier) (Identifier)) ([])) - (Error) - (Error)) + (Function + ( + (Identifier) + (Identifier)) + { (Identifier) + ->(Identifier) } + ([])) + (Function + ( + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier))) + { (Identifier) + ->(Identifier) } + ([]))) diff --git a/test/fixtures/go/function-declarations.parseA.txt b/test/fixtures/go/function-declarations.parseA.txt index b45f5f054..cd1a10acb 100644 --- a/test/fixtures/go/function-declarations.parseA.txt +++ b/test/fixtures/go/function-declarations.parseA.txt @@ -21,5 +21,19 @@ (Identifier) (Identifier)) ([])) - (Error) - (Error)) + (Function + ( + (Identifier) + (Identifier)) + (Identifier) + ([])) + (Function + ( + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier))) + (Identifier) + ([]))) diff --git a/test/fixtures/go/function-declarations.parseB.txt b/test/fixtures/go/function-declarations.parseB.txt index b45f5f054..cd1a10acb 100644 --- a/test/fixtures/go/function-declarations.parseB.txt +++ b/test/fixtures/go/function-declarations.parseB.txt @@ -21,5 +21,19 @@ (Identifier) (Identifier)) ([])) - (Error) - (Error)) + (Function + ( + (Identifier) + (Identifier)) + (Identifier) + ([])) + (Function + ( + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier))) + (Identifier) + ([]))) From 19e9c9e068450ac28af12805d128228d7f89a184 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 11:00:21 -0700 Subject: [PATCH 066/176] Assign function literals --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ca01caa76..e11a4cb03 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -385,7 +385,8 @@ expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment -functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) +functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) + <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') parameters = symbol Parameters *> children (many expression) returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) From 5312425c4786f1d0982d7b10c213d0ce0972fea3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 11:00:45 -0700 Subject: [PATCH 067/176] Whitespace --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index e11a4cb03..83a782378 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -386,7 +386,7 @@ expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) - <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) + <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') parameters = symbol Parameters *> children (many expression) returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) From f4b8e302cade8ed5e8f63283b21af5f2f9b1404c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 11:06:40 -0700 Subject: [PATCH 068/176] Update function literal tests --- test/fixtures/go/function-literals.diffA-B.txt | 17 ++++++++++++++++- test/fixtures/go/function-literals.diffB-A.txt | 17 ++++++++++++++++- test/fixtures/go/function-literals.parseA.txt | 13 ++++++++++++- test/fixtures/go/function-literals.parseB.txt | 13 ++++++++++++- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/function-literals.diffA-B.txt b/test/fixtures/go/function-literals.diffA-B.txt index ae2fde0a2..621956de7 100644 --- a/test/fixtures/go/function-literals.diffA-B.txt +++ b/test/fixtures/go/function-literals.diffA-B.txt @@ -6,4 +6,19 @@ (Identifier) (Assignment (Identifier) - (Error)))) + (Function + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Return + ( + (Integer) + (Integer))))))) diff --git a/test/fixtures/go/function-literals.diffB-A.txt b/test/fixtures/go/function-literals.diffB-A.txt index ae2fde0a2..621956de7 100644 --- a/test/fixtures/go/function-literals.diffB-A.txt +++ b/test/fixtures/go/function-literals.diffB-A.txt @@ -6,4 +6,19 @@ (Identifier) (Assignment (Identifier) - (Error)))) + (Function + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Return + ( + (Integer) + (Integer))))))) diff --git a/test/fixtures/go/function-literals.parseA.txt b/test/fixtures/go/function-literals.parseA.txt index ae2fde0a2..5c548793c 100644 --- a/test/fixtures/go/function-literals.parseA.txt +++ b/test/fixtures/go/function-literals.parseA.txt @@ -6,4 +6,15 @@ (Identifier) (Assignment (Identifier) - (Error)))) + (Function + ( + (Identifier) + (Identifier)) + (Empty) + ( + (Identifier) + (Identifier)) + (Return + ( + (Integer) + (Integer))))))) diff --git a/test/fixtures/go/function-literals.parseB.txt b/test/fixtures/go/function-literals.parseB.txt index ae2fde0a2..5c548793c 100644 --- a/test/fixtures/go/function-literals.parseB.txt +++ b/test/fixtures/go/function-literals.parseB.txt @@ -6,4 +6,15 @@ (Identifier) (Assignment (Identifier) - (Error)))) + (Function + ( + (Identifier) + (Identifier)) + (Empty) + ( + (Identifier) + (Identifier)) + (Return + ( + (Integer) + (Integer))))))) From 4a0544072ac2b187db3f5422490b898fbafd80dc Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 12:01:29 -0700 Subject: [PATCH 069/176] Make fields eager for Go.Syntax constructors --- src/Language/Go/Syntax.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index b0bf52683..33f0e5a83 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -35,7 +35,7 @@ instance Ord1 RuneLiteral where liftCompare = genericLiftCompare instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec -- | A labeled statement in Go (e.g. label:continue) -data Label a = Label { labelName :: a, labelStatement :: a } +data Label a = Label { labelName :: !a, labelStatement :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Label where liftEq = genericLiftEq @@ -43,7 +43,7 @@ instance Ord1 Label where liftCompare = genericLiftCompare instance Show1 Label where liftShowsPrec = genericLiftShowsPrec -- | A send statement in Go (e.g. channel <- value). -data Send a = Send { sendReceiver :: a, sendValue :: a } +data Send a = Send { sendReceiver :: !a, sendValue :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Send where liftEq = genericLiftEq From 4db08d3b29cc469a1189e2763d9e3bb509f9d441 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 12:01:40 -0700 Subject: [PATCH 070/176] Add Defer constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 33f0e5a83..251800c18 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -49,3 +49,11 @@ data Send a = Send { sendReceiver :: !a, sendValue :: !a } instance Eq1 Send where liftEq = genericLiftEq instance Ord1 Send where liftCompare = genericLiftCompare instance Show1 Send where liftShowsPrec = genericLiftShowsPrec + +-- | A defer statement in Go (e.g. defer x()) +newtype Defer a = Defer { deferBody :: a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Defer where liftEq = genericLiftEq +instance Ord1 Defer where liftCompare = genericLiftCompare +instance Show1 Defer where liftShowsPrec = genericLiftShowsPrec From 6d663037dece8b9f7eeb249134133b19225755ba Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 13:54:33 -0700 Subject: [PATCH 071/176] Assign defer statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 83a782378..ce498cc79 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -41,6 +41,7 @@ type Syntax = , Statement.PostIncrement , Expression.MemberAccess , Go.Syntax.DefaultPattern + , Go.Syntax.Defer , Go.Syntax.Label , Go.Syntax.RuneLiteral , Go.Syntax.Send @@ -108,6 +109,7 @@ expressionChoices = , varDeclaration , varSpecification , decStatement + , deferStatement , element , elseClause , expressionCaseClause @@ -464,6 +466,9 @@ continueStatement = makeTerm <$> symbol ContinueStatement <*> children (Statemen decStatement :: Assignment decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecrement <$> expression) +deferStatement :: Assignment +deferStatement = makeTerm <$> symbol DeferStatement <*> children (Go.Syntax.Defer <$> expression) + gotoStatement :: Assignment gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression) From 32bec02926b33e5ab3209831e41d51b1305500f7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 13:59:01 -0700 Subject: [PATCH 072/176] Add Go constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 251800c18..aed6db053 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -57,3 +57,11 @@ newtype Defer a = Defer { deferBody :: a } instance Eq1 Defer where liftEq = genericLiftEq instance Ord1 Defer where liftCompare = genericLiftCompare instance Show1 Defer where liftShowsPrec = genericLiftShowsPrec + +-- | A go statement (i.e. go routine) in Go (e.g. go x()) +newtype Go a = Go { goBody :: a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Go where liftEq = genericLiftEq +instance Ord1 Go where liftCompare = genericLiftCompare +instance Show1 Go where liftShowsPrec = genericLiftShowsPrec From 3a434e50aa9015316a9c5cb168fb74113fae8da0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 13:59:10 -0700 Subject: [PATCH 073/176] Assign go statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ce498cc79..e39dfaa2e 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -42,6 +42,7 @@ type Syntax = , Expression.MemberAccess , Go.Syntax.DefaultPattern , Go.Syntax.Defer + , Go.Syntax.Go , Go.Syntax.Label , Go.Syntax.RuneLiteral , Go.Syntax.Send @@ -122,6 +123,7 @@ expressionChoices = , forStatement , functionDeclaration , functionType + , goStatement , gotoStatement , ifInitializer , ifStatement @@ -469,6 +471,9 @@ decStatement = makeTerm <$> symbol DecStatement <*> children (Statement.PostDecr deferStatement :: Assignment deferStatement = makeTerm <$> symbol DeferStatement <*> children (Go.Syntax.Defer <$> expression) +goStatement :: Assignment +goStatement = makeTerm <$> symbol GoStatement <*> children (Go.Syntax.Go <$> expression) + gotoStatement :: Assignment gotoStatement = makeTerm <$> symbol GotoStatement <*> children (Statement.Goto <$> expression) From a889eb1d98af49ba57b6873ead8a4e3e1f5d7808 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 14:03:19 -0700 Subject: [PATCH 074/176] Update go and defer statement tests --- .../go/go-and-defer-statements.diffA-B.txt | 21 ++++++++++++++++++- .../go/go-and-defer-statements.diffB-A.txt | 21 ++++++++++++++++++- .../go/go-and-defer-statements.parseA.txt | 17 ++++++++++++++- .../go/go-and-defer-statements.parseB.txt | 17 ++++++++++++++- 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/go-and-defer-statements.diffA-B.txt b/test/fixtures/go/go-and-defer-statements.diffA-B.txt index e31b62159..3d3b7e2b5 100644 --- a/test/fixtures/go/go-and-defer-statements.diffA-B.txt +++ b/test/fixtures/go/go-and-defer-statements.diffA-B.txt @@ -1,4 +1,23 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Defer + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty))) + (Go + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty)))))) diff --git a/test/fixtures/go/go-and-defer-statements.diffB-A.txt b/test/fixtures/go/go-and-defer-statements.diffB-A.txt index e31b62159..3d3b7e2b5 100644 --- a/test/fixtures/go/go-and-defer-statements.diffB-A.txt +++ b/test/fixtures/go/go-and-defer-statements.diffB-A.txt @@ -1,4 +1,23 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Defer + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty))) + (Go + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Empty)))))) diff --git a/test/fixtures/go/go-and-defer-statements.parseA.txt b/test/fixtures/go/go-and-defer-statements.parseA.txt index e31b62159..b1ad7a81a 100644 --- a/test/fixtures/go/go-and-defer-statements.parseA.txt +++ b/test/fixtures/go/go-and-defer-statements.parseA.txt @@ -1,4 +1,19 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Defer + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Empty))) + (Go + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Empty)))))) diff --git a/test/fixtures/go/go-and-defer-statements.parseB.txt b/test/fixtures/go/go-and-defer-statements.parseB.txt index e31b62159..b1ad7a81a 100644 --- a/test/fixtures/go/go-and-defer-statements.parseB.txt +++ b/test/fixtures/go/go-and-defer-statements.parseB.txt @@ -1,4 +1,19 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Defer + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Empty))) + (Go + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Empty)))))) From e055f1d4fa3646445e1f23a950a85f543c68a39c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 14:39:24 -0700 Subject: [PATCH 075/176] Add Slice constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index aed6db053..811758057 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -65,3 +65,11 @@ newtype Go a = Go { goBody :: a } instance Eq1 Go where liftEq = genericLiftEq instance Ord1 Go where liftCompare = genericLiftCompare instance Show1 Go where liftShowsPrec = genericLiftShowsPrec + +-- | A slice expression in Go (e.g. a[1:4:3] where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity). +data Slice a = Slice { sliceName :: !a, sliceBody :: ![a] } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Slice where liftEq = genericLiftEq +instance Ord1 Slice where liftCompare = genericLiftCompare +instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec From bb91865343ccf7a684b87db2038e8b40874c1f40 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 14:40:55 -0700 Subject: [PATCH 076/176] Add periods --- src/Language/Go/Syntax.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 811758057..0f87fbc1a 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -26,7 +26,7 @@ instance Eq1 DefaultPattern where liftEq = genericLiftEq instance Ord1 DefaultPattern where liftCompare = genericLiftCompare instance Show1 DefaultPattern where liftShowsPrec = genericLiftShowsPrec --- | A rune literal in Go (e.g. '⌘') +-- | A rune literal in Go (e.g. '⌘'). newtype RuneLiteral a = RuneLiteral { runeLiteralContent :: ByteString } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -34,7 +34,7 @@ instance Eq1 RuneLiteral where liftEq = genericLiftEq instance Ord1 RuneLiteral where liftCompare = genericLiftCompare instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec --- | A labeled statement in Go (e.g. label:continue) +-- | A labeled statement in Go (e.g. label:continue). data Label a = Label { labelName :: !a, labelStatement :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -50,7 +50,7 @@ instance Eq1 Send where liftEq = genericLiftEq instance Ord1 Send where liftCompare = genericLiftCompare instance Show1 Send where liftShowsPrec = genericLiftShowsPrec --- | A defer statement in Go (e.g. defer x()) +-- | A defer statement in Go (e.g. defer x()). newtype Defer a = Defer { deferBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -58,7 +58,7 @@ instance Eq1 Defer where liftEq = genericLiftEq instance Ord1 Defer where liftCompare = genericLiftCompare instance Show1 Defer where liftShowsPrec = genericLiftShowsPrec --- | A go statement (i.e. go routine) in Go (e.g. go x()) +-- | A go statement (i.e. go routine) in Go (e.g. go x()). newtype Go a = Go { goBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From 88e56166f2855660d23626796b8bd234f9708376 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 14:58:00 -0700 Subject: [PATCH 077/176] Update Slice constructor fields --- src/Language/Go/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 0f87fbc1a..93f6c056f 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -67,7 +67,7 @@ instance Ord1 Go where liftCompare = genericLiftCompare instance Show1 Go where liftShowsPrec = genericLiftShowsPrec -- | A slice expression in Go (e.g. a[1:4:3] where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity). -data Slice a = Slice { sliceName :: !a, sliceBody :: ![a] } +data Slice a = Slice { sliceName :: !a, sliceLow :: !a, sliceHigh :: !a, sliceCapacity :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Slice where liftEq = genericLiftEq From c9a0e119950b0b8d5616f823cd98b900b983324f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 14:58:22 -0700 Subject: [PATCH 078/176] Assign slice expressions --- src/Language/Go/Assignment.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index e39dfaa2e..33c4d37d1 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -46,6 +46,7 @@ type Syntax = , Go.Syntax.Label , Go.Syntax.RuneLiteral , Go.Syntax.Send + , Go.Syntax.Slice , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -155,6 +156,7 @@ expressionChoices = , selectorExpression , sendStatement , shortVarDeclaration + , sliceExpression , sliceType , structType , typeDeclaration @@ -309,6 +311,14 @@ typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children -- Expressions +sliceExpression :: Assignment +sliceExpression = makeTerm <$> symbol SliceExpression <*> children ( (Go.Syntax.Slice <$> expression <*> expression <*> expression <*> expression) + <|> (Go.Syntax.Slice <$> expression <*> emptyTerm <* symbol AnonColon <*> expression <* symbol AnonColon <*> expression) + <|> (Go.Syntax.Slice <$> expression <*> emptyTerm <* symbol AnonColon <*> expression <*> emptyTerm) + <|> (Go.Syntax.Slice <$> expression <*> expression <*> expression <*> emptyTerm) + <|> (Go.Syntax.Slice <$> expression <*> expression <*> emptyTerm <*> emptyTerm) + <|> (Go.Syntax.Slice <$> expression <*> emptyTerm <*> emptyTerm <*> emptyTerm)) + parenthesizedExpression :: Assignment parenthesizedExpression = symbol ParenthesizedExpression *> children expressions From 41927400da89dec962976b68c027d3fc649641b4 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 14:58:31 -0700 Subject: [PATCH 079/176] Assign index expressions --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 33c4d37d1..779b59014 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -37,6 +37,7 @@ type Syntax = , Expression.Boolean , Expression.Call , Expression.Comparison + , Expression.Subscript , Statement.PostDecrement , Statement.PostIncrement , Expression.MemberAccess @@ -134,6 +135,7 @@ expressionChoices = , implicitLengthArrayType , importDeclaration , importSpec + , indexExpression , interfaceType , interpretedStringLiteral , intLiteral @@ -311,6 +313,9 @@ typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children -- Expressions +indexExpression :: Assignment +indexExpression = makeTerm <$> symbol IndexExpression <*> children (Expression.Subscript <$> expression <*> many expression) + sliceExpression :: Assignment sliceExpression = makeTerm <$> symbol SliceExpression <*> children ( (Go.Syntax.Slice <$> expression <*> expression <*> expression <*> expression) <|> (Go.Syntax.Slice <$> expression <*> emptyTerm <* symbol AnonColon <*> expression <* symbol AnonColon <*> expression) From 6d53916a051361e0bec9d853262e10dcc9e6c105 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 15:11:29 -0700 Subject: [PATCH 080/176] Update index and slice expression tests --- test/fixtures/go/indexing-expressions.A.go | 2 +- test/fixtures/go/indexing-expressions.B.go | 8 +-- .../go/indexing-expressions.diffA-B.txt | 63 ++++++++++++++++++- .../go/indexing-expressions.diffB-A.txt | 58 ++++++++++++++++- .../go/indexing-expressions.parseA.txt | 33 +++++++++- .../go/indexing-expressions.parseB.txt | 35 ++++++++++- 6 files changed, 190 insertions(+), 9 deletions(-) diff --git a/test/fixtures/go/indexing-expressions.A.go b/test/fixtures/go/indexing-expressions.A.go index c2c76934c..56e76590b 100644 --- a/test/fixtures/go/indexing-expressions.A.go +++ b/test/fixtures/go/indexing-expressions.A.go @@ -1,7 +1,7 @@ package main func main() { -a[1] + a[1] b[:] c[1:] d[1:2] diff --git a/test/fixtures/go/indexing-expressions.B.go b/test/fixtures/go/indexing-expressions.B.go index 68a763403..63b2bbba7 100644 --- a/test/fixtures/go/indexing-expressions.B.go +++ b/test/fixtures/go/indexing-expressions.B.go @@ -1,10 +1,10 @@ package main func main() { -z[:2] + z[:2] y[:1] x[1:] - d[1:2] - e[:2:3] - f[1:2:3] + d[1:3] + e[:3:3] + f[2:3:3] } diff --git a/test/fixtures/go/indexing-expressions.diffA-B.txt b/test/fixtures/go/indexing-expressions.diffA-B.txt index e31b62159..7222118d1 100644 --- a/test/fixtures/go/indexing-expressions.diffA-B.txt +++ b/test/fixtures/go/indexing-expressions.diffA-B.txt @@ -1,4 +1,65 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Empty)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Empty)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Empty)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+} + {+(Integer)+})+} + {-(Subscript + {-(Identifier)-} + {-(Integer)-})-} + {-(Slice + {-(Identifier)-} + {-(Empty)-} + {-(Empty)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Empty)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Integer)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Integer)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Integer)-} + {-(Integer)-})-}))) diff --git a/test/fixtures/go/indexing-expressions.diffB-A.txt b/test/fixtures/go/indexing-expressions.diffB-A.txt index e31b62159..9595f2f64 100644 --- a/test/fixtures/go/indexing-expressions.diffB-A.txt +++ b/test/fixtures/go/indexing-expressions.diffB-A.txt @@ -1,4 +1,60 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + {+(Subscript + {+(Identifier)+} + {+(Integer)+})+} + {+(Slice + {+(Identifier)+} + {+(Empty)+} + {+(Empty)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Empty)+} + {+(Empty)+})+} + {+(Slice + {+(Identifier)+} + {+(Integer)+} + {+(Integer)+} + {+(Empty)+})+} + (Slice + { (Identifier) + ->(Identifier) } + (Integer) + { (Empty) + ->(Integer) } + (Empty)) + (Slice + { (Identifier) + ->(Identifier) } + (Integer) + { (Empty) + ->(Integer) } + { (Empty) + ->(Integer) }) + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Empty)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Integer)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Integer)-} + {-(Empty)-})-} + {-(Slice + {-(Identifier)-} + {-(Integer)-} + {-(Integer)-} + {-(Integer)-})-}))) diff --git a/test/fixtures/go/indexing-expressions.parseA.txt b/test/fixtures/go/indexing-expressions.parseA.txt index e31b62159..dc299a6c0 100644 --- a/test/fixtures/go/indexing-expressions.parseA.txt +++ b/test/fixtures/go/indexing-expressions.parseA.txt @@ -1,4 +1,35 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Subscript + (Identifier) + (Integer)) + (Slice + (Identifier) + (Empty) + (Empty) + (Empty)) + (Slice + (Identifier) + (Integer) + (Empty) + (Empty)) + (Slice + (Identifier) + (Integer) + (Integer) + (Empty)) + (Slice + (Identifier) + (Integer) + (Integer) + (Empty)) + (Slice + (Identifier) + (Integer) + (Integer) + (Integer))))) diff --git a/test/fixtures/go/indexing-expressions.parseB.txt b/test/fixtures/go/indexing-expressions.parseB.txt index e31b62159..213c514b6 100644 --- a/test/fixtures/go/indexing-expressions.parseB.txt +++ b/test/fixtures/go/indexing-expressions.parseB.txt @@ -1,4 +1,37 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (Slice + (Identifier) + (Integer) + (Empty) + (Empty)) + (Slice + (Identifier) + (Integer) + (Empty) + (Empty)) + (Slice + (Identifier) + (Integer) + (Empty) + (Empty)) + (Slice + (Identifier) + (Integer) + (Integer) + (Empty)) + (Slice + (Identifier) + (Integer) + (Integer) + (Empty)) + (Slice + (Identifier) + (Integer) + (Integer) + (Integer))))) From d54b0ba6e6cdcc922ece259ad05635b9464151d2 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:02:13 -0700 Subject: [PATCH 081/176] Assign field identifiers for method specs --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 779b59014..fb05a3a9a 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -152,6 +152,7 @@ expressionChoices = , parenthesizedExpression , parenthesizedType , pointerType + , qualifiedType , rawStringLiteral , returnStatement , runeLiteral @@ -429,7 +430,7 @@ methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> ch mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') methodSpec :: Assignment -methodSpec = mkMethodSpec <$> symbol MethodSpec <*> children ((,,,,) <$> empty <*> identifier <*> parameters <*> (expression <|> parameters <|> emptyTerm) <*> empty) +methodSpec = mkMethodSpec <$> symbol MethodSpec <*> children ((,,,,) <$> empty <*> expression <*> parameters <*> (expression <|> parameters <|> emptyTerm) <*> empty) where parameters = makeTerm <$> symbol Parameters <*> children (many expression) empty = makeTerm <$> location <*> pure Syntax.Empty mkMethodSpec loc (receiver', name', params, optionaltypeLiteral, body') = makeTerm loc $ Type.Annotation (mkMethod loc receiver' name' params body') optionaltypeLiteral From 974fc9c7c67919ada2210af530abdd589b38e7c4 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:06:39 -0700 Subject: [PATCH 082/176] Update interface types tests --- test/fixtures/go/interface-types.diffA-B.txt | 21 ++++++++++++++++++-- test/fixtures/go/interface-types.diffB-A.txt | 21 ++++++++++++++++++-- test/fixtures/go/interface-types.parseA.txt | 21 ++++++++++++++++++-- test/fixtures/go/interface-types.parseB.txt | 21 ++++++++++++++++++-- 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/interface-types.diffA-B.txt b/test/fixtures/go/interface-types.diffA-B.txt index 8e93f0dfe..b62dd2fa8 100644 --- a/test/fixtures/go/interface-types.diffA-B.txt +++ b/test/fixtures/go/interface-types.diffA-B.txt @@ -14,9 +14,26 @@ (Annotation { (Identifier) ->(Identifier) } - (Error))) + (Interface + (MemberAccess + (Identifier) + (Identifier))))) ( (Annotation { (Identifier) ->(Identifier) } - (Error)))))) + (Interface + (Identifier) + (MemberAccess + (Identifier) + (Identifier)) + (Annotation + (Method + (Empty) + (Identifier) + ( + ( + (Identifier) + (Identifier))) + (Empty)) + (Identifier)))))))) diff --git a/test/fixtures/go/interface-types.diffB-A.txt b/test/fixtures/go/interface-types.diffB-A.txt index 8e93f0dfe..b62dd2fa8 100644 --- a/test/fixtures/go/interface-types.diffB-A.txt +++ b/test/fixtures/go/interface-types.diffB-A.txt @@ -14,9 +14,26 @@ (Annotation { (Identifier) ->(Identifier) } - (Error))) + (Interface + (MemberAccess + (Identifier) + (Identifier))))) ( (Annotation { (Identifier) ->(Identifier) } - (Error)))))) + (Interface + (Identifier) + (MemberAccess + (Identifier) + (Identifier)) + (Annotation + (Method + (Empty) + (Identifier) + ( + ( + (Identifier) + (Identifier))) + (Empty)) + (Identifier)))))))) diff --git a/test/fixtures/go/interface-types.parseA.txt b/test/fixtures/go/interface-types.parseA.txt index 484e46c2c..196a1faad 100644 --- a/test/fixtures/go/interface-types.parseA.txt +++ b/test/fixtures/go/interface-types.parseA.txt @@ -12,8 +12,25 @@ ( (Annotation (Identifier) - (Error))) + (Interface + (MemberAccess + (Identifier) + (Identifier))))) ( (Annotation (Identifier) - (Error)))))) + (Interface + (Identifier) + (MemberAccess + (Identifier) + (Identifier)) + (Annotation + (Method + (Empty) + (Identifier) + ( + ( + (Identifier) + (Identifier))) + (Empty)) + (Identifier)))))))) diff --git a/test/fixtures/go/interface-types.parseB.txt b/test/fixtures/go/interface-types.parseB.txt index 484e46c2c..196a1faad 100644 --- a/test/fixtures/go/interface-types.parseB.txt +++ b/test/fixtures/go/interface-types.parseB.txt @@ -12,8 +12,25 @@ ( (Annotation (Identifier) - (Error))) + (Interface + (MemberAccess + (Identifier) + (Identifier))))) ( (Annotation (Identifier) - (Error)))))) + (Interface + (Identifier) + (MemberAccess + (Identifier) + (Identifier)) + (Annotation + (Method + (Empty) + (Identifier) + ( + ( + (Identifier) + (Identifier))) + (Empty)) + (Identifier)))))))) From 2d8cdee378e37bc88c15c8d1abfbbeaca8aea45f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:06:54 -0700 Subject: [PATCH 083/176] Update modifying struct fields tests --- test/fixtures/go/modifying-struct-fields.diffA-B.txt | 7 ++++++- test/fixtures/go/modifying-struct-fields.diffB-A.txt | 7 ++++++- test/fixtures/go/modifying-struct-fields.parseB.txt | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/fixtures/go/modifying-struct-fields.diffA-B.txt b/test/fixtures/go/modifying-struct-fields.diffA-B.txt index 44a0d30d4..9d1912f5c 100644 --- a/test/fixtures/go/modifying-struct-fields.diffA-B.txt +++ b/test/fixtures/go/modifying-struct-fields.diffA-B.txt @@ -14,4 +14,9 @@ { (Identifier) ->(Identifier) } { (Identifier) - ->(Error) }))))))) + ->(Call + {+(Identifier)+} + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(Empty)+}) }))))))) diff --git a/test/fixtures/go/modifying-struct-fields.diffB-A.txt b/test/fixtures/go/modifying-struct-fields.diffB-A.txt index 3269dc719..1cf3407af 100644 --- a/test/fixtures/go/modifying-struct-fields.diffB-A.txt +++ b/test/fixtures/go/modifying-struct-fields.diffB-A.txt @@ -13,5 +13,10 @@ (KeyValue { (Identifier) ->(Identifier) } - { (Error) + { (Call + {-(Identifier)-} + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(Empty)-}) ->(Identifier) }))))))) diff --git a/test/fixtures/go/modifying-struct-fields.parseB.txt b/test/fixtures/go/modifying-struct-fields.parseB.txt index 73319fa12..8e11371ed 100644 --- a/test/fixtures/go/modifying-struct-fields.parseB.txt +++ b/test/fixtures/go/modifying-struct-fields.parseB.txt @@ -12,4 +12,9 @@ ( (KeyValue (Identifier) - (Error)))))))) + (Call + (Identifier) + (MemberAccess + (Identifier) + (Identifier)) + (Empty))))))))) From 8836344d1d7ed7a7b59cb50ad9d133533fb842a3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:07:08 -0700 Subject: [PATCH 084/176] Update struct types tests --- test/fixtures/go/struct-literals.diffA-B.txt | 7 ++++++- test/fixtures/go/struct-literals.diffB-A.txt | 7 ++++++- test/fixtures/go/struct-literals.parseA.txt | 6 +++++- test/fixtures/go/struct-literals.parseB.txt | 6 +++++- test/fixtures/go/struct-types.diffA-B.txt | 6 +++++- test/fixtures/go/struct-types.diffB-A.txt | 6 +++++- test/fixtures/go/struct-types.parseA.txt | 6 +++++- test/fixtures/go/struct-types.parseB.txt | 6 +++++- 8 files changed, 42 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/struct-literals.diffA-B.txt b/test/fixtures/go/struct-literals.diffA-B.txt index 4b7fa19ff..143657cc1 100644 --- a/test/fixtures/go/struct-literals.diffA-B.txt +++ b/test/fixtures/go/struct-literals.diffA-B.txt @@ -36,4 +36,9 @@ ->(Integer) })))) (Assignment (Identifier) - (Error))))) + (Composite + (MemberAccess + (Identifier) + { (Identifier) + ->(Identifier) }) + ([])))))) diff --git a/test/fixtures/go/struct-literals.diffB-A.txt b/test/fixtures/go/struct-literals.diffB-A.txt index 4b7fa19ff..143657cc1 100644 --- a/test/fixtures/go/struct-literals.diffB-A.txt +++ b/test/fixtures/go/struct-literals.diffB-A.txt @@ -36,4 +36,9 @@ ->(Integer) })))) (Assignment (Identifier) - (Error))))) + (Composite + (MemberAccess + (Identifier) + { (Identifier) + ->(Identifier) }) + ([])))))) diff --git a/test/fixtures/go/struct-literals.parseA.txt b/test/fixtures/go/struct-literals.parseA.txt index 3056c5fe2..a4256b564 100644 --- a/test/fixtures/go/struct-literals.parseA.txt +++ b/test/fixtures/go/struct-literals.parseA.txt @@ -32,4 +32,8 @@ (Integer))))) (Assignment (Identifier) - (Error))))) + (Composite + (MemberAccess + (Identifier) + (Identifier)) + ([])))))) diff --git a/test/fixtures/go/struct-literals.parseB.txt b/test/fixtures/go/struct-literals.parseB.txt index 3056c5fe2..a4256b564 100644 --- a/test/fixtures/go/struct-literals.parseB.txt +++ b/test/fixtures/go/struct-literals.parseB.txt @@ -32,4 +32,8 @@ (Integer))))) (Assignment (Identifier) - (Error))))) + (Composite + (MemberAccess + (Identifier) + (Identifier)) + ([])))))) diff --git a/test/fixtures/go/struct-types.diffA-B.txt b/test/fixtures/go/struct-types.diffA-B.txt index c395c4872..efb6bb28f 100644 --- a/test/fixtures/go/struct-types.diffA-B.txt +++ b/test/fixtures/go/struct-types.diffA-B.txt @@ -33,5 +33,9 @@ ->(Identifier) } (Constructor (Empty) - (Error) + (Annotation + ([]) + (MemberAccess + (Identifier) + (Identifier))) (Error))))))) diff --git a/test/fixtures/go/struct-types.diffB-A.txt b/test/fixtures/go/struct-types.diffB-A.txt index c395c4872..efb6bb28f 100644 --- a/test/fixtures/go/struct-types.diffB-A.txt +++ b/test/fixtures/go/struct-types.diffB-A.txt @@ -33,5 +33,9 @@ ->(Identifier) } (Constructor (Empty) - (Error) + (Annotation + ([]) + (MemberAccess + (Identifier) + (Identifier))) (Error))))))) diff --git a/test/fixtures/go/struct-types.parseA.txt b/test/fixtures/go/struct-types.parseA.txt index 1e89b4e56..b2455fe68 100644 --- a/test/fixtures/go/struct-types.parseA.txt +++ b/test/fixtures/go/struct-types.parseA.txt @@ -29,5 +29,9 @@ (Identifier) (Constructor (Empty) - (Error) + (Annotation + ([]) + (MemberAccess + (Identifier) + (Identifier))) (Error))))))) diff --git a/test/fixtures/go/struct-types.parseB.txt b/test/fixtures/go/struct-types.parseB.txt index 1e89b4e56..b2455fe68 100644 --- a/test/fixtures/go/struct-types.parseB.txt +++ b/test/fixtures/go/struct-types.parseB.txt @@ -29,5 +29,9 @@ (Identifier) (Constructor (Empty) - (Error) + (Annotation + ([]) + (MemberAccess + (Identifier) + (Identifier))) (Error))))))) From f54f9bec8a12bb67d46369452c96dc1749f96a38 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:57:01 -0700 Subject: [PATCH 085/176] Syntax quote Go syntax examples --- src/Language/Go/Syntax.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 93f6c056f..1536514bf 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -18,7 +18,7 @@ instance Eq1 Variadic where liftEq = genericLiftEq instance Ord1 Variadic where liftCompare = genericLiftCompare instance Show1 Variadic where liftShowsPrec = genericLiftShowsPrec --- | A default pattern in a Go case statement (e.g. `switch { default: s() }`). +-- | A default pattern in a Go select or switch statement (e.g. `switch { default: s() }`). newtype DefaultPattern a = DefaultPattern { defaultPatternBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -26,7 +26,7 @@ instance Eq1 DefaultPattern where liftEq = genericLiftEq instance Ord1 DefaultPattern where liftCompare = genericLiftCompare instance Show1 DefaultPattern where liftShowsPrec = genericLiftShowsPrec --- | A rune literal in Go (e.g. '⌘'). +-- | A rune literal in Go (e.g. `'⌘'`). newtype RuneLiteral a = RuneLiteral { runeLiteralContent :: ByteString } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -34,7 +34,7 @@ instance Eq1 RuneLiteral where liftEq = genericLiftEq instance Ord1 RuneLiteral where liftCompare = genericLiftCompare instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec --- | A labeled statement in Go (e.g. label:continue). +-- | A labeled statement in Go (e.g. `label:continue`). data Label a = Label { labelName :: !a, labelStatement :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -42,7 +42,7 @@ instance Eq1 Label where liftEq = genericLiftEq instance Ord1 Label where liftCompare = genericLiftCompare instance Show1 Label where liftShowsPrec = genericLiftShowsPrec --- | A send statement in Go (e.g. channel <- value). +-- | A send statement in Go (e.g. `channel <- value`). data Send a = Send { sendReceiver :: !a, sendValue :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -50,7 +50,7 @@ instance Eq1 Send where liftEq = genericLiftEq instance Ord1 Send where liftCompare = genericLiftCompare instance Show1 Send where liftShowsPrec = genericLiftShowsPrec --- | A defer statement in Go (e.g. defer x()). +-- | A defer statement in Go (e.g. `defer x()`). newtype Defer a = Defer { deferBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -58,7 +58,7 @@ instance Eq1 Defer where liftEq = genericLiftEq instance Ord1 Defer where liftCompare = genericLiftCompare instance Show1 Defer where liftShowsPrec = genericLiftShowsPrec --- | A go statement (i.e. go routine) in Go (e.g. go x()). +-- | A go statement (i.e. go routine) in Go (e.g. `go x()`). newtype Go a = Go { goBody :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) @@ -66,7 +66,7 @@ instance Eq1 Go where liftEq = genericLiftEq instance Ord1 Go where liftCompare = genericLiftCompare instance Show1 Go where liftShowsPrec = genericLiftShowsPrec --- | A slice expression in Go (e.g. a[1:4:3] where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity). +-- | A slice expression in Go (e.g. `a[1:4:3]` where a is a list, 1 is the low bound, 4 is the high bound, and 3 is the max capacity). data Slice a = Slice { sliceName :: !a, sliceLow :: !a, sliceHigh :: !a, sliceCapacity :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From f518de2cf13e4e68e52d0d7acb707c8a466725e0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:57:19 -0700 Subject: [PATCH 086/176] Add Select constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 1536514bf..ad120ecb4 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -73,3 +73,11 @@ data Slice a = Slice { sliceName :: !a, sliceLow :: !a, sliceHigh :: !a, sliceCa instance Eq1 Slice where liftEq = genericLiftEq instance Ord1 Slice where liftCompare = genericLiftCompare instance Show1 Slice where liftShowsPrec = genericLiftShowsPrec + +-- | A select statement in Go (e.g. `select { case x := <-c: x() }` where each case is a send or receive operation on channels). +data Select a = Select { selectCases :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Select where liftEq = genericLiftEq +instance Ord1 Select where liftCompare = genericLiftCompare +instance Show1 Select where liftShowsPrec = genericLiftShowsPrec From 06ef5c8d0d5e1960f792b376498ae8bc96e43137 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:57:33 -0700 Subject: [PATCH 087/176] Add Communication constructor --- src/Language/Go/Syntax.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index ad120ecb4..045b62e56 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -81,3 +81,12 @@ data Select a = Select { selectCases :: !a } instance Eq1 Select where liftEq = genericLiftEq instance Ord1 Select where liftCompare = genericLiftCompare instance Show1 Select where liftShowsPrec = genericLiftShowsPrec + +-- | A communication clause in a Go select statement (e.g. `select { case x := <-c: x() }` where `case x:= <-c:` is the communication subject and `x()` is the communication body). +data Communication a = Communication { communicationSubject :: !a, communicationBody :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Communication where liftEq = genericLiftEq +instance Ord1 Communication where liftCompare = genericLiftCompare +instance Show1 Communication where liftShowsPrec = genericLiftShowsPrec + From 443f8b9ff20b82f3eb9702ef2c3cb955ccc6b420 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:57:40 -0700 Subject: [PATCH 088/176] Add Receive constructor --- src/Language/Go/Syntax.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 045b62e56..2c50a3003 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -90,3 +90,10 @@ instance Eq1 Communication where liftEq = genericLiftEq instance Ord1 Communication where liftCompare = genericLiftCompare instance Show1 Communication where liftShowsPrec = genericLiftShowsPrec +-- | A receive statement in Go (e.g. `value = <-channel` ) +data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Receive where liftEq = genericLiftEq +instance Ord1 Receive where liftCompare = genericLiftCompare +instance Show1 Receive where liftShowsPrec = genericLiftShowsPrec From dbaa97a632f025e66e14a45046b12c5772b42724 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:58:12 -0700 Subject: [PATCH 089/176] Assign receive statements --- src/Language/Go/Assignment.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index fb05a3a9a..f885e68fa 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -45,6 +45,7 @@ type Syntax = , Go.Syntax.Defer , Go.Syntax.Go , Go.Syntax.Label + , Go.Syntax.Receive , Go.Syntax.RuneLiteral , Go.Syntax.Send , Go.Syntax.Slice @@ -154,6 +155,7 @@ expressionChoices = , pointerType , qualifiedType , rawStringLiteral + , receiveStatement , returnStatement , runeLiteral , selectorExpression @@ -332,11 +334,12 @@ selectorExpression :: Assignment selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expression.MemberAccess <$> expression <*> expression) unaryExpression :: Assignment -unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand +unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) unaryPlus = children (symbol AnonPlus *> expression) unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Statement.Reference <$> expression)) + unaryReceive = children (symbol AnonLAngleMinus *> expression) binaryExpression :: Assignment binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression @@ -531,6 +534,10 @@ labelStatement' = makeTerm <$> symbol LabelStatement <*> children (Go.Syntax.Lab returnStatement :: Assignment returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Return <$> (expression <|> emptyTerm)) +receiveStatement :: Assignment +receiveStatement = makeTerm <$> symbol ReceiveStatement <*> children ( (Go.Syntax.Receive <$> expression <*> expression) + <|> (Go.Syntax.Receive <$> emptyTerm <*> expression)) + -- Helpers -- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. From a0a5e66b5438e0537a501bea915dc6c22f688c8a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 16:58:39 -0700 Subject: [PATCH 090/176] Assign select statements --- src/Language/Go/Assignment.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index f885e68fa..6a5680636 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -41,12 +41,14 @@ type Syntax = , Statement.PostDecrement , Statement.PostIncrement , Expression.MemberAccess + , Go.Syntax.Communication , Go.Syntax.DefaultPattern , Go.Syntax.Defer , Go.Syntax.Go , Go.Syntax.Label , Go.Syntax.Receive , Go.Syntax.RuneLiteral + , Go.Syntax.Select , Go.Syntax.Send , Go.Syntax.Slice , Go.Syntax.Variadic @@ -108,6 +110,7 @@ expressionChoices = , callExpression , channelType , comment + , communicationClause , compositeLiteral , continueStatement , varDeclaration @@ -158,6 +161,7 @@ expressionChoices = , receiveStatement , returnStatement , runeLiteral + , selectStatement , selectorExpression , sendStatement , shortVarDeclaration @@ -538,6 +542,14 @@ receiveStatement :: Assignment receiveStatement = makeTerm <$> symbol ReceiveStatement <*> children ( (Go.Syntax.Receive <$> expression <*> expression) <|> (Go.Syntax.Receive <$> emptyTerm <*> expression)) +selectStatement :: Assignment +selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) + +communicationClause :: Assignment +communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Go.Syntax.Communication <$> communicationCase <*> expression) + where + communicationCase = symbol CommunicationCase *> children expression + -- Helpers -- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. From f17032bd2e1dd92b9182d732c4e3a5cca469725f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 17:05:47 -0700 Subject: [PATCH 091/176] Update select statement tests --- test/fixtures/go/select-statements.A.go | 2 - test/fixtures/go/select-statements.B.go | 2 - .../fixtures/go/select-statements.diffA-B.txt | 38 ++++++++++++++++++- .../fixtures/go/select-statements.diffB-A.txt | 38 ++++++++++++++++++- test/fixtures/go/select-statements.parseA.txt | 35 ++++++++++++++++- test/fixtures/go/select-statements.parseB.txt | 35 ++++++++++++++++- 6 files changed, 142 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/select-statements.A.go b/test/fixtures/go/select-statements.A.go index 6806fa67d..dfcefb499 100644 --- a/test/fixtures/go/select-statements.A.go +++ b/test/fixtures/go/select-statements.A.go @@ -8,7 +8,5 @@ select { println(5) case <-time.After(1): println(6) - default: - return } } diff --git a/test/fixtures/go/select-statements.B.go b/test/fixtures/go/select-statements.B.go index 1ca26fb9f..0a24aebf7 100644 --- a/test/fixtures/go/select-statements.B.go +++ b/test/fixtures/go/select-statements.B.go @@ -8,7 +8,5 @@ select { println(5) case <-time.After(2): println(6) - default: - return } } diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index e31b62159..7eb78e7e6 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -1,4 +1,40 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Select + ( + (Communication + (Receive + { (Identifier) + ->(Identifier) } + (Identifier)) + (Call + (Identifier) + (Identifier) + (Empty))) + (Communication + (Send + { (Identifier) + ->(Identifier) } + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Communication + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (Integer) + ->(Integer) } + (Empty))) + (Call + (Identifier) + (Integer) + (Empty))))))) diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index e31b62159..7eb78e7e6 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -1,4 +1,40 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Select + ( + (Communication + (Receive + { (Identifier) + ->(Identifier) } + (Identifier)) + (Call + (Identifier) + (Identifier) + (Empty))) + (Communication + (Send + { (Identifier) + ->(Identifier) } + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Communication + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (Integer) + ->(Integer) } + (Empty))) + (Call + (Identifier) + (Integer) + (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index e31b62159..00096e55d 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -1,4 +1,37 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Select + ( + (Communication + (Receive + (Identifier) + (Identifier)) + (Call + (Identifier) + (Identifier) + (Empty))) + (Communication + (Send + (Identifier) + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Communication + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty))) + (Call + (Identifier) + (Integer) + (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index e31b62159..00096e55d 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -1,4 +1,37 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (Select + ( + (Communication + (Receive + (Identifier) + (Identifier)) + (Call + (Identifier) + (Identifier) + (Empty))) + (Communication + (Send + (Identifier) + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Communication + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty))) + (Call + (Identifier) + (Integer) + (Empty))))))) From 422d5421e7036b9f24e69c815ede1fc0ef2fa278 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 17:06:01 -0700 Subject: [PATCH 092/176] Update unary expression tests --- test/fixtures/go/unary-expressions.diffA-B.txt | 3 ++- test/fixtures/go/unary-expressions.diffB-A.txt | 3 ++- test/fixtures/go/unary-expressions.parseA.txt | 2 +- test/fixtures/go/unary-expressions.parseB.txt | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/unary-expressions.diffA-B.txt b/test/fixtures/go/unary-expressions.diffA-B.txt index 30352e42a..20a844503 100644 --- a/test/fixtures/go/unary-expressions.diffA-B.txt +++ b/test/fixtures/go/unary-expressions.diffA-B.txt @@ -6,5 +6,6 @@ (Identifier) ( (Not - (Error)) + { (Identifier) + ->(Identifier) }) (Error)))) diff --git a/test/fixtures/go/unary-expressions.diffB-A.txt b/test/fixtures/go/unary-expressions.diffB-A.txt index 30352e42a..20a844503 100644 --- a/test/fixtures/go/unary-expressions.diffB-A.txt +++ b/test/fixtures/go/unary-expressions.diffB-A.txt @@ -6,5 +6,6 @@ (Identifier) ( (Not - (Error)) + { (Identifier) + ->(Identifier) }) (Error)))) diff --git a/test/fixtures/go/unary-expressions.parseA.txt b/test/fixtures/go/unary-expressions.parseA.txt index 30352e42a..bb1435bf7 100644 --- a/test/fixtures/go/unary-expressions.parseA.txt +++ b/test/fixtures/go/unary-expressions.parseA.txt @@ -6,5 +6,5 @@ (Identifier) ( (Not - (Error)) + (Identifier)) (Error)))) diff --git a/test/fixtures/go/unary-expressions.parseB.txt b/test/fixtures/go/unary-expressions.parseB.txt index 30352e42a..bb1435bf7 100644 --- a/test/fixtures/go/unary-expressions.parseB.txt +++ b/test/fixtures/go/unary-expressions.parseB.txt @@ -6,5 +6,5 @@ (Identifier) ( (Not - (Error)) + (Identifier)) (Error)))) From 447527968e67968a0c3b1aafab8e5d24f8531363 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 17:13:36 -0700 Subject: [PATCH 093/176] Bump haskell-tree-sitter --- vendor/haskell-tree-sitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index 46d51913c..e38fa5c33 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit 46d51913c232847920763d039b435ef993bb44d6 +Subproject commit e38fa5c33d214cb633e4bb9183abe93b845bf2c8 From da90e3613d1715e0dc8f3fa5969eecf5cc4b6881 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 17:25:06 -0700 Subject: [PATCH 094/176] Add DefaultCommunication constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 2c50a3003..0fb21501f 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -90,6 +90,14 @@ instance Eq1 Communication where liftEq = genericLiftEq instance Ord1 Communication where liftCompare = genericLiftCompare instance Show1 Communication where liftShowsPrec = genericLiftShowsPrec +-- | A default communication case in a Go select statement. +data DefaultCommunication a = DefaultCommunication + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 DefaultCommunication where liftEq = genericLiftEq +instance Ord1 DefaultCommunication where liftCompare = genericLiftCompare +instance Show1 DefaultCommunication where liftShowsPrec = genericLiftShowsPrec + -- | A receive statement in Go (e.g. `value = <-channel` ) data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From 5dcaa31fcf0dcc574ab0e4c7c19fe0b610c7554a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 17:25:26 -0700 Subject: [PATCH 095/176] Assign default communication case statements --- src/Language/Go/Assignment.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 6a5680636..794b7a272 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -42,6 +42,7 @@ type Syntax = , Statement.PostIncrement , Expression.MemberAccess , Go.Syntax.Communication + , Go.Syntax.DefaultCommunication , Go.Syntax.DefaultPattern , Go.Syntax.Defer , Go.Syntax.Go @@ -546,9 +547,10 @@ selectStatement :: Assignment selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) communicationClause :: Assignment -communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Go.Syntax.Communication <$> communicationCase <*> expression) +communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Go.Syntax.Communication <$> (communicationCase <|> defaultCommunicationCase) <*> expression) where communicationCase = symbol CommunicationCase *> children expression + defaultCommunicationCase = makeTerm <$> symbol DefaultCommunicationCase <*> (Go.Syntax.DefaultCommunication <$ source) -- Helpers From 6a68092feb4f47228d8e5470d7ff679a8b31b14e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 1 Nov 2017 17:32:00 -0700 Subject: [PATCH 096/176] Add default communication cases to select statements tests --- test/fixtures/go/select-statements.A.go | 2 ++ test/fixtures/go/select-statements.B.go | 2 ++ test/fixtures/go/select-statements.diffA-B.txt | 4 ++++ test/fixtures/go/select-statements.diffB-A.txt | 4 ++++ test/fixtures/go/select-statements.parseA.txt | 4 ++++ test/fixtures/go/select-statements.parseB.txt | 4 ++++ 6 files changed, 20 insertions(+) diff --git a/test/fixtures/go/select-statements.A.go b/test/fixtures/go/select-statements.A.go index dfcefb499..6806fa67d 100644 --- a/test/fixtures/go/select-statements.A.go +++ b/test/fixtures/go/select-statements.A.go @@ -8,5 +8,7 @@ select { println(5) case <-time.After(1): println(6) + default: + return } } diff --git a/test/fixtures/go/select-statements.B.go b/test/fixtures/go/select-statements.B.go index 0a24aebf7..1ca26fb9f 100644 --- a/test/fixtures/go/select-statements.B.go +++ b/test/fixtures/go/select-statements.B.go @@ -8,5 +8,7 @@ select { println(5) case <-time.After(2): println(6) + default: + return } } diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 7eb78e7e6..086ff4fa8 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -37,4 +37,8 @@ (Call (Identifier) (Integer) + (Empty))) + (Communication + (DefaultCommunication) + (Return (Empty))))))) diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 7eb78e7e6..086ff4fa8 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -37,4 +37,8 @@ (Call (Identifier) (Integer) + (Empty))) + (Communication + (DefaultCommunication) + (Return (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index 00096e55d..c47efcc3a 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -34,4 +34,8 @@ (Call (Identifier) (Integer) + (Empty))) + (Communication + (DefaultCommunication) + (Return (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index 00096e55d..c47efcc3a 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -34,4 +34,8 @@ (Call (Identifier) (Integer) + (Empty))) + (Communication + (DefaultCommunication) + (Return (Empty))))))) From 4b7da9b75befe1521c5f21cfefbdb81518568969 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 11:24:09 -0700 Subject: [PATCH 097/176] Assign field declarations for multiple field identifiers --- src/Language/Go/Assignment.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 794b7a272..bc5063db6 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -273,10 +273,10 @@ pointerType :: Assignment pointerType = handleError $ makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression) fieldDeclaration :: Assignment -fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> many identifier <*> expression <*> optional expression) +fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> manyTermsTill expression (void (symbol TypeIdentifier)) <*> expression <*> optional expression) where - mkFieldDeclarationWithTag loc (fields, type', (Just tag)) = makeTerm loc $ Type.Annotation (makeTerm loc (Type.Annotation (makeTerm loc fields) type')) tag - mkFieldDeclarationWithTag loc (fields, type', Nothing) = makeTerm loc $ Type.Annotation (makeTerm loc fields) type' + mkFieldDeclarationWithTag loc (fields, type', (Just tag)) = makeTerm loc $ Type.Annotation (makeTerm loc (Type.Annotation (makeTerm loc fields) type')) tag + mkFieldDeclarationWithTag loc (fields, type', Nothing) = makeTerm loc $ Type.Annotation (makeTerm loc fields) type' -- Type Declarations From 4289eef106dfac6804cd63dd887adb0231123f6c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 11:28:19 -0700 Subject: [PATCH 098/176] Update struct field declarations tests --- .../go/struct-field-declarations.diffA-B.txt | 12 ++++++------ .../go/struct-field-declarations.diffB-A.txt | 12 ++++++------ .../fixtures/go/struct-field-declarations.parseA.txt | 3 +-- .../fixtures/go/struct-field-declarations.parseB.txt | 6 +++++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/test/fixtures/go/struct-field-declarations.diffA-B.txt b/test/fixtures/go/struct-field-declarations.diffA-B.txt index 81af7c572..e4a11f6a5 100644 --- a/test/fixtures/go/struct-field-declarations.diffA-B.txt +++ b/test/fixtures/go/struct-field-declarations.diffA-B.txt @@ -9,9 +9,9 @@ (Identifier) (Constructor (Empty) - {+(Error)+} - {-(Annotation - {-(Annotation - {-([])-} - {-(Identifier)-})-} - {-(Identifier)-})-}))))) + (Annotation + ( + { (Identifier) + ->(Identifier) } + {+(Identifier)+}) + (Identifier))))))) diff --git a/test/fixtures/go/struct-field-declarations.diffB-A.txt b/test/fixtures/go/struct-field-declarations.diffB-A.txt index 10d6b7740..87a6d7748 100644 --- a/test/fixtures/go/struct-field-declarations.diffB-A.txt +++ b/test/fixtures/go/struct-field-declarations.diffB-A.txt @@ -9,9 +9,9 @@ (Identifier) (Constructor (Empty) - {+(Annotation - {+(Annotation - {+([])+} - {+(Identifier)+})+} - {+(Identifier)+})+} - {-(Error)-}))))) + (Annotation + ( + { (Identifier) + ->(Identifier) } + {-(Identifier)-}) + (Identifier))))))) diff --git a/test/fixtures/go/struct-field-declarations.parseA.txt b/test/fixtures/go/struct-field-declarations.parseA.txt index cea38fdfc..4116ed52f 100644 --- a/test/fixtures/go/struct-field-declarations.parseA.txt +++ b/test/fixtures/go/struct-field-declarations.parseA.txt @@ -10,7 +10,6 @@ (Constructor (Empty) (Annotation - (Annotation - ([]) + ( (Identifier)) (Identifier))))))) diff --git a/test/fixtures/go/struct-field-declarations.parseB.txt b/test/fixtures/go/struct-field-declarations.parseB.txt index ac08c051e..1bc7f6e74 100644 --- a/test/fixtures/go/struct-field-declarations.parseB.txt +++ b/test/fixtures/go/struct-field-declarations.parseB.txt @@ -9,4 +9,8 @@ (Identifier) (Constructor (Empty) - (Error)))))) + (Annotation + ( + (Identifier) + (Identifier)) + (Identifier))))))) From 96280bd59c8237f28339df3a7977a2f61bfb403e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 11:28:36 -0700 Subject: [PATCH 099/176] Update struct literals tests --- test/fixtures/go/struct-literals.diffA-B.txt | 3 +-- test/fixtures/go/struct-literals.diffB-A.txt | 3 +-- test/fixtures/go/struct-literals.parseA.txt | 3 +-- test/fixtures/go/struct-literals.parseB.txt | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/struct-literals.diffA-B.txt b/test/fixtures/go/struct-literals.diffA-B.txt index 143657cc1..4e45fe96d 100644 --- a/test/fixtures/go/struct-literals.diffA-B.txt +++ b/test/fixtures/go/struct-literals.diffA-B.txt @@ -23,8 +23,7 @@ (Constructor (Empty) (Annotation - (Annotation - ([]) + ( (Identifier)) { (Identifier) ->(Identifier) })) diff --git a/test/fixtures/go/struct-literals.diffB-A.txt b/test/fixtures/go/struct-literals.diffB-A.txt index 143657cc1..4e45fe96d 100644 --- a/test/fixtures/go/struct-literals.diffB-A.txt +++ b/test/fixtures/go/struct-literals.diffB-A.txt @@ -23,8 +23,7 @@ (Constructor (Empty) (Annotation - (Annotation - ([]) + ( (Identifier)) { (Identifier) ->(Identifier) })) diff --git a/test/fixtures/go/struct-literals.parseA.txt b/test/fixtures/go/struct-literals.parseA.txt index a4256b564..a79c6d65f 100644 --- a/test/fixtures/go/struct-literals.parseA.txt +++ b/test/fixtures/go/struct-literals.parseA.txt @@ -22,8 +22,7 @@ (Constructor (Empty) (Annotation - (Annotation - ([]) + ( (Identifier)) (Identifier))) ( diff --git a/test/fixtures/go/struct-literals.parseB.txt b/test/fixtures/go/struct-literals.parseB.txt index a4256b564..a79c6d65f 100644 --- a/test/fixtures/go/struct-literals.parseB.txt +++ b/test/fixtures/go/struct-literals.parseB.txt @@ -22,8 +22,7 @@ (Constructor (Empty) (Annotation - (Annotation - ([]) + ( (Identifier)) (Identifier))) ( From a66fb949866a94792217a29d025d21bd334231bb Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 11:54:34 -0700 Subject: [PATCH 100/176] Add Field constructor for Constructors (Structs) --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 0fb21501f..34fb537f4 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -105,3 +105,11 @@ data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } instance Eq1 Receive where liftEq = genericLiftEq instance Ord1 Receive where liftCompare = genericLiftCompare instance Show1 Receive where liftShowsPrec = genericLiftShowsPrec + +-- | A field declaration in a Go struct type declaration. +data Field a = Field { fieldContext :: ![a], fieldName :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Field where liftEq = genericLiftEq +instance Ord1 Field where liftCompare = genericLiftCompare +instance Show1 Field where liftShowsPrec = genericLiftShowsPrec From bb9403cea0a0863d905ca648d0b99ee8f29c1464 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 11:55:03 -0700 Subject: [PATCH 101/176] Improve assignment for field declarations --- src/Language/Go/Assignment.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index bc5063db6..17a3216a6 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -45,6 +45,7 @@ type Syntax = , Go.Syntax.DefaultCommunication , Go.Syntax.DefaultPattern , Go.Syntax.Defer + , Go.Syntax.Field , Go.Syntax.Go , Go.Syntax.Label , Go.Syntax.Receive @@ -273,10 +274,13 @@ pointerType :: Assignment pointerType = handleError $ makeTerm <$> symbol PointerType <*> children (Type.Pointer <$> expression) fieldDeclaration :: Assignment -fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> manyTermsTill expression (void (symbol TypeIdentifier)) <*> expression <*> optional expression) +fieldDeclaration = mkFieldDeclarationWithTag <$> symbol FieldDeclaration <*> children ((,,) <$> (manyTermsTill expression (void (symbol TypeIdentifier)) <|> (many expression)) <*> optional expression <*> optional expression) where - mkFieldDeclarationWithTag loc (fields, type', (Just tag)) = makeTerm loc $ Type.Annotation (makeTerm loc (Type.Annotation (makeTerm loc fields) type')) tag - mkFieldDeclarationWithTag loc (fields, type', Nothing) = makeTerm loc $ Type.Annotation (makeTerm loc fields) type' + mkFieldDeclarationWithTag loc (fields, (Just type'), (Just tag)) = makeTerm loc $ Go.Syntax.Field [type', tag] (makeTerm loc fields) --Type.Annotation (makeTerm loc (Type.Annotation (makeTerm loc fields) type')) tag + mkFieldDeclarationWithTag loc (fields, (Just type'), Nothing) = makeTerm loc $ Go.Syntax.Field [type'] (makeTerm loc fields) + mkFieldDeclarationWithTag loc (fields, Nothing, (Just tag)) = makeTerm loc $ Go.Syntax.Field [tag] (makeTerm loc fields) + mkFieldDeclarationWithTag loc (fields, Nothing, Nothing) = makeTerm loc $ Go.Syntax.Field [] (makeTerm loc fields) + -- Type Declarations From 2d09a1e5ebf083fd136dd6ec943ea22d527ab1d9 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 12:07:34 -0700 Subject: [PATCH 102/176] Update field declarations tests --- test/fixtures/go/struct-field-declarations.diffA-B.txt | 6 +++--- test/fixtures/go/struct-field-declarations.diffB-A.txt | 6 +++--- test/fixtures/go/struct-field-declarations.parseA.txt | 6 +++--- test/fixtures/go/struct-field-declarations.parseB.txt | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/fixtures/go/struct-field-declarations.diffA-B.txt b/test/fixtures/go/struct-field-declarations.diffA-B.txt index e4a11f6a5..d362256ef 100644 --- a/test/fixtures/go/struct-field-declarations.diffA-B.txt +++ b/test/fixtures/go/struct-field-declarations.diffA-B.txt @@ -9,9 +9,9 @@ (Identifier) (Constructor (Empty) - (Annotation + (Field + (Identifier) ( { (Identifier) ->(Identifier) } - {+(Identifier)+}) - (Identifier))))))) + {+(Identifier)+}))))))) diff --git a/test/fixtures/go/struct-field-declarations.diffB-A.txt b/test/fixtures/go/struct-field-declarations.diffB-A.txt index 87a6d7748..5f9766134 100644 --- a/test/fixtures/go/struct-field-declarations.diffB-A.txt +++ b/test/fixtures/go/struct-field-declarations.diffB-A.txt @@ -9,9 +9,9 @@ (Identifier) (Constructor (Empty) - (Annotation + (Field + (Identifier) ( { (Identifier) ->(Identifier) } - {-(Identifier)-}) - (Identifier))))))) + {-(Identifier)-}))))))) diff --git a/test/fixtures/go/struct-field-declarations.parseA.txt b/test/fixtures/go/struct-field-declarations.parseA.txt index 4116ed52f..aa51b2f40 100644 --- a/test/fixtures/go/struct-field-declarations.parseA.txt +++ b/test/fixtures/go/struct-field-declarations.parseA.txt @@ -9,7 +9,7 @@ (Identifier) (Constructor (Empty) - (Annotation + (Field + (Identifier) ( - (Identifier)) - (Identifier))))))) + (Identifier)))))))) diff --git a/test/fixtures/go/struct-field-declarations.parseB.txt b/test/fixtures/go/struct-field-declarations.parseB.txt index 1bc7f6e74..7c260159a 100644 --- a/test/fixtures/go/struct-field-declarations.parseB.txt +++ b/test/fixtures/go/struct-field-declarations.parseB.txt @@ -9,8 +9,8 @@ (Identifier) (Constructor (Empty) - (Annotation + (Field + (Identifier) ( (Identifier) - (Identifier)) - (Identifier))))))) + (Identifier)))))))) From 6ba4eeed9c0f89b239b8c225e9074837f79e822b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 12:07:45 -0700 Subject: [PATCH 103/176] Update struct literals tests --- test/fixtures/go/struct-literals.diffA-B.txt | 8 ++++---- test/fixtures/go/struct-literals.diffB-A.txt | 8 ++++---- test/fixtures/go/struct-literals.parseA.txt | 6 +++--- test/fixtures/go/struct-literals.parseB.txt | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/fixtures/go/struct-literals.diffA-B.txt b/test/fixtures/go/struct-literals.diffA-B.txt index 4e45fe96d..a7239de97 100644 --- a/test/fixtures/go/struct-literals.diffA-B.txt +++ b/test/fixtures/go/struct-literals.diffA-B.txt @@ -22,11 +22,11 @@ (Composite (Constructor (Empty) - (Annotation - ( - (Identifier)) + (Field { (Identifier) - ->(Identifier) })) + ->(Identifier) } + ( + (Identifier)))) ( (KeyValue { (Identifier) diff --git a/test/fixtures/go/struct-literals.diffB-A.txt b/test/fixtures/go/struct-literals.diffB-A.txt index 4e45fe96d..a7239de97 100644 --- a/test/fixtures/go/struct-literals.diffB-A.txt +++ b/test/fixtures/go/struct-literals.diffB-A.txt @@ -22,11 +22,11 @@ (Composite (Constructor (Empty) - (Annotation - ( - (Identifier)) + (Field { (Identifier) - ->(Identifier) })) + ->(Identifier) } + ( + (Identifier)))) ( (KeyValue { (Identifier) diff --git a/test/fixtures/go/struct-literals.parseA.txt b/test/fixtures/go/struct-literals.parseA.txt index a79c6d65f..451b881bd 100644 --- a/test/fixtures/go/struct-literals.parseA.txt +++ b/test/fixtures/go/struct-literals.parseA.txt @@ -21,10 +21,10 @@ (Composite (Constructor (Empty) - (Annotation + (Field + (Identifier) ( - (Identifier)) - (Identifier))) + (Identifier)))) ( (KeyValue (Identifier) diff --git a/test/fixtures/go/struct-literals.parseB.txt b/test/fixtures/go/struct-literals.parseB.txt index a79c6d65f..451b881bd 100644 --- a/test/fixtures/go/struct-literals.parseB.txt +++ b/test/fixtures/go/struct-literals.parseB.txt @@ -21,10 +21,10 @@ (Composite (Constructor (Empty) - (Annotation + (Field + (Identifier) ( - (Identifier)) - (Identifier))) + (Identifier)))) ( (KeyValue (Identifier) From a40906df6731b860a034df085f1916751edf2619 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 12:07:57 -0700 Subject: [PATCH 104/176] Update struct types tests --- test/fixtures/go/struct-types.diffA-B.txt | 38 ++++++++++++++--------- test/fixtures/go/struct-types.diffB-A.txt | 38 ++++++++++++++--------- test/fixtures/go/struct-types.parseA.txt | 36 ++++++++++++--------- test/fixtures/go/struct-types.parseB.txt | 36 ++++++++++++--------- 4 files changed, 90 insertions(+), 58 deletions(-) diff --git a/test/fixtures/go/struct-types.diffA-B.txt b/test/fixtures/go/struct-types.diffA-B.txt index efb6bb28f..d4c624a48 100644 --- a/test/fixtures/go/struct-types.diffA-B.txt +++ b/test/fixtures/go/struct-types.diffA-B.txt @@ -17,25 +17,33 @@ ->(Identifier) } (Constructor (Empty) - (Annotation - ([]) - (Identifier))))) + (Field + (Identifier) + ([]))))) ( (Annotation { (Identifier) ->(Identifier) } (Constructor (Empty) - (Error)))) - ( - (Annotation - { (Identifier) - ->(Identifier) } - (Constructor - (Empty) - (Annotation - ([]) - (MemberAccess + (Field + (Identifier) + ( (Identifier) - (Identifier))) - (Error))))))) + (Identifier)))))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Field + ( + (MemberAccess + (Identifier) + (Identifier)))) + (Field + (Identifier) + (TextElement) + ( + (Identifier))))))))) diff --git a/test/fixtures/go/struct-types.diffB-A.txt b/test/fixtures/go/struct-types.diffB-A.txt index efb6bb28f..d4c624a48 100644 --- a/test/fixtures/go/struct-types.diffB-A.txt +++ b/test/fixtures/go/struct-types.diffB-A.txt @@ -17,25 +17,33 @@ ->(Identifier) } (Constructor (Empty) - (Annotation - ([]) - (Identifier))))) + (Field + (Identifier) + ([]))))) ( (Annotation { (Identifier) ->(Identifier) } (Constructor (Empty) - (Error)))) - ( - (Annotation - { (Identifier) - ->(Identifier) } - (Constructor - (Empty) - (Annotation - ([]) - (MemberAccess + (Field + (Identifier) + ( (Identifier) - (Identifier))) - (Error))))))) + (Identifier)))))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Constructor + (Empty) + (Field + ( + (MemberAccess + (Identifier) + (Identifier)))) + (Field + (Identifier) + (TextElement) + ( + (Identifier))))))))) diff --git a/test/fixtures/go/struct-types.parseA.txt b/test/fixtures/go/struct-types.parseA.txt index b2455fe68..95abd736b 100644 --- a/test/fixtures/go/struct-types.parseA.txt +++ b/test/fixtures/go/struct-types.parseA.txt @@ -15,23 +15,31 @@ (Identifier) (Constructor (Empty) - (Annotation - ([]) - (Identifier))))) + (Field + (Identifier) + ([]))))) ( (Annotation (Identifier) (Constructor (Empty) - (Error)))) - ( - (Annotation - (Identifier) - (Constructor - (Empty) - (Annotation - ([]) - (MemberAccess + (Field + (Identifier) + ( (Identifier) - (Identifier))) - (Error))))))) + (Identifier)))))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Field + ( + (MemberAccess + (Identifier) + (Identifier)))) + (Field + (Identifier) + (TextElement) + ( + (Identifier))))))))) diff --git a/test/fixtures/go/struct-types.parseB.txt b/test/fixtures/go/struct-types.parseB.txt index b2455fe68..95abd736b 100644 --- a/test/fixtures/go/struct-types.parseB.txt +++ b/test/fixtures/go/struct-types.parseB.txt @@ -15,23 +15,31 @@ (Identifier) (Constructor (Empty) - (Annotation - ([]) - (Identifier))))) + (Field + (Identifier) + ([]))))) ( (Annotation (Identifier) (Constructor (Empty) - (Error)))) - ( - (Annotation - (Identifier) - (Constructor - (Empty) - (Annotation - ([]) - (MemberAccess + (Field + (Identifier) + ( (Identifier) - (Identifier))) - (Error))))))) + (Identifier)))))) + ( + (Annotation + (Identifier) + (Constructor + (Empty) + (Field + ( + (MemberAccess + (Identifier) + (Identifier)))) + (Field + (Identifier) + (TextElement) + ( + (Identifier))))))))) From e737f0ddb18753a5717526537c8cdd6e2938fb70 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 13:02:11 -0700 Subject: [PATCH 105/176] Add TypeAssertion constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 34fb537f4..0a3879e10 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -113,3 +113,11 @@ data Field a = Field { fieldContext :: ![a], fieldName :: !a } instance Eq1 Field where liftEq = genericLiftEq instance Ord1 Field where liftCompare = genericLiftCompare instance Show1 Field where liftShowsPrec = genericLiftShowsPrec + +-- | A type assertion in Go (e.g. x.(T) where the value of x is not nil and is of type T). +data TypeAssertion a = TypeAssertion { typeAssertionSubject :: !a, typeAssertionType :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 TypeAssertion where liftEq = genericLiftEq +instance Ord1 TypeAssertion where liftCompare = genericLiftCompare +instance Show1 TypeAssertion where liftShowsPrec = genericLiftShowsPrec From 11bd169080516635d0c1426917e5cae456584ee0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 13:02:25 -0700 Subject: [PATCH 106/176] Assign type assertion expressions --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 17a3216a6..235274f07 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -53,6 +53,7 @@ type Syntax = , Go.Syntax.Select , Go.Syntax.Send , Go.Syntax.Slice + , Go.Syntax.TypeAssertion , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -170,6 +171,7 @@ expressionChoices = , sliceExpression , sliceType , structType + , typeAssertion , typeDeclaration , typeIdentifier , unaryExpression @@ -342,6 +344,9 @@ parenthesizedExpression = symbol ParenthesizedExpression *> children expressions selectorExpression :: Assignment selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expression.MemberAccess <$> expression <*> expression) +typeAssertion :: Assignment +typeAssertion = makeTerm <$> symbol TypeAssertionExpression <*> children (Go.Syntax.TypeAssertion <$> expression <*> expression) + unaryExpression :: Assignment unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) From 583135b3994acdd157e8a67fa50ffdf739390a04 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 13:07:29 -0700 Subject: [PATCH 107/176] Update type assertion tests --- .../go/type-assertion-expressions.diffA-B.txt | 12 +++++++++++- .../go/type-assertion-expressions.diffB-A.txt | 12 +++++++++++- .../go/type-assertion-expressions.parseA.txt | 9 ++++++++- .../go/type-assertion-expressions.parseB.txt | 9 ++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/type-assertion-expressions.diffA-B.txt b/test/fixtures/go/type-assertion-expressions.diffA-B.txt index e31b62159..2790d23cd 100644 --- a/test/fixtures/go/type-assertion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-assertion-expressions.diffA-B.txt @@ -1,4 +1,14 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeAssertion + { (Identifier) + ->(Identifier) } + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })))) diff --git a/test/fixtures/go/type-assertion-expressions.diffB-A.txt b/test/fixtures/go/type-assertion-expressions.diffB-A.txt index e31b62159..2790d23cd 100644 --- a/test/fixtures/go/type-assertion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-assertion-expressions.diffB-A.txt @@ -1,4 +1,14 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeAssertion + { (Identifier) + ->(Identifier) } + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })))) diff --git a/test/fixtures/go/type-assertion-expressions.parseA.txt b/test/fixtures/go/type-assertion-expressions.parseA.txt index e31b62159..67e138ff6 100644 --- a/test/fixtures/go/type-assertion-expressions.parseA.txt +++ b/test/fixtures/go/type-assertion-expressions.parseA.txt @@ -1,4 +1,11 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeAssertion + (Identifier) + (MemberAccess + (Identifier) + (Identifier))))) diff --git a/test/fixtures/go/type-assertion-expressions.parseB.txt b/test/fixtures/go/type-assertion-expressions.parseB.txt index e31b62159..67e138ff6 100644 --- a/test/fixtures/go/type-assertion-expressions.parseB.txt +++ b/test/fixtures/go/type-assertion-expressions.parseB.txt @@ -1,4 +1,11 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeAssertion + (Identifier) + (MemberAccess + (Identifier) + (Identifier))))) From 42cd73e67e738005bc1f8839f15f680276126777 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 16:10:51 -0700 Subject: [PATCH 108/176] Add TypeConversion constructor --- src/Language/Go/Syntax.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 0a3879e10..c4044bb84 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -121,3 +121,10 @@ data TypeAssertion a = TypeAssertion { typeAssertionSubject :: !a, typeAssertion instance Eq1 TypeAssertion where liftEq = genericLiftEq instance Ord1 TypeAssertion where liftCompare = genericLiftCompare instance Show1 TypeAssertion where liftShowsPrec = genericLiftShowsPrec + +data TypeConversion a = TypeConversion { typeConversionType :: !a, typeConversionSubject :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 TypeConversion where liftEq = genericLiftEq +instance Ord1 TypeConversion where liftCompare = genericLiftCompare +instance Show1 TypeConversion where liftShowsPrec = genericLiftShowsPrec From 2c2925bedb7afddea2e7d4a5bbbf7f0f38545e19 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 2 Nov 2017 16:11:00 -0700 Subject: [PATCH 109/176] Assign type conversion statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 235274f07..7fca5c1d1 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -54,6 +54,7 @@ type Syntax = , Go.Syntax.Send , Go.Syntax.Slice , Go.Syntax.TypeAssertion + , Go.Syntax.TypeConversion , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -172,6 +173,7 @@ expressionChoices = , sliceType , structType , typeAssertion + , typeConversion , typeDeclaration , typeIdentifier , unaryExpression @@ -347,6 +349,9 @@ selectorExpression = makeTerm <$> symbol SelectorExpression <*> children (Expres typeAssertion :: Assignment typeAssertion = makeTerm <$> symbol TypeAssertionExpression <*> children (Go.Syntax.TypeAssertion <$> expression <*> expression) +typeConversion :: Assignment +typeConversion = makeTerm <$> symbol TypeConversionExpression <*> children (Go.Syntax.TypeConversion <$> expression <*> expression) + unaryExpression :: Assignment unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) From 39d0b31010766071487309cb295edfab5c093825 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 15:00:46 -0700 Subject: [PATCH 110/176] Move Pointer and Reference constructors from Statement.hs to Literal.hs --- src/Data/Syntax/Literal.hs | 20 ++++++++++++++++++++ src/Data/Syntax/Statement.hs | 19 ------------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Data/Syntax/Literal.hs b/src/Data/Syntax/Literal.hs index be75754be..0b2dfb47b 100644 --- a/src/Data/Syntax/Literal.hs +++ b/src/Data/Syntax/Literal.hs @@ -159,6 +159,26 @@ instance Eq1 Set where liftEq = genericLiftEq instance Ord1 Set where liftCompare = genericLiftCompare instance Show1 Set where liftShowsPrec = genericLiftShowsPrec + +-- Pointers + +-- | A declared pointer (e.g. var pointer *int in Go) +newtype Pointer a = Pointer a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Pointer where liftEq = genericLiftEq +instance Ord1 Pointer where liftCompare = genericLiftCompare +instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec + +-- | A reference to a pointer's address (e.g. &pointer in Go) +newtype Reference a = Reference a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Reference where liftEq = genericLiftEq +instance Ord1 Reference where liftCompare = genericLiftCompare +instance Show1 Reference where liftShowsPrec = genericLiftShowsPrec + + -- Misc -- A channel literal in Go diff --git a/src/Data/Syntax/Statement.hs b/src/Data/Syntax/Statement.hs index 69c48a4e5..1afe3b599 100644 --- a/src/Data/Syntax/Statement.hs +++ b/src/Data/Syntax/Statement.hs @@ -59,25 +59,6 @@ instance Ord1 Let where liftCompare = genericLiftCompare instance Show1 Let where liftShowsPrec = genericLiftShowsPrec --- Pointers - --- | A declared pointer (e.g. var pointer *int in Go) -newtype Pointer a = Pointer a - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) - -instance Eq1 Pointer where liftEq = genericLiftEq -instance Ord1 Pointer where liftCompare = genericLiftCompare -instance Show1 Pointer where liftShowsPrec = genericLiftShowsPrec - --- | A reference to a pointer's address (e.g. &pointer in Go) -newtype Reference a = Reference a - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) - -instance Eq1 Reference where liftEq = genericLiftEq -instance Ord1 Reference where liftCompare = genericLiftCompare -instance Show1 Reference where liftShowsPrec = genericLiftShowsPrec - - -- Assignment -- | Assignment to a variable or other lvalue. From eba0d3098326bab3fceb1a73b3b080595cb21f98 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 15:01:23 -0700 Subject: [PATCH 111/176] Assign pointer literals --- src/Language/Go/Assignment.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 7fca5c1d1..a57387b37 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -64,6 +64,8 @@ type Syntax = , Literal.Hash , Literal.Integer , Literal.KeyValue + , Literal.Pointer + , Literal.Reference , Literal.TextElement , Statement.Assignment , Statement.Break @@ -74,8 +76,6 @@ type Syntax = , Statement.If , Statement.Match , Statement.Pattern - , Statement.Pointer - , Statement.Reference , Statement.Return , Syntax.Context , Syntax.Error @@ -353,12 +353,13 @@ typeConversion :: Assignment typeConversion = makeTerm <$> symbol TypeConversionExpression <*> children (Go.Syntax.TypeConversion <$> expression <*> expression) unaryExpression :: Assignment -unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive +unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive <|> unaryPointer where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) unaryPlus = children (symbol AnonPlus *> expression) - unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Statement.Reference <$> expression)) + unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Literal.Reference <$> expression)) unaryReceive = children (symbol AnonLAngleMinus *> expression) + unaryPointer = children (makeTerm <$> symbol AnonStar <*> (Literal.Pointer <$> expression)) binaryExpression :: Assignment binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression From bbe0e0c3f4a4705590265c2ac6a35ee45426f6c3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 15:10:13 -0700 Subject: [PATCH 112/176] Assign type alias declarations --- src/Language/Go/Assignment.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index a57387b37..0c117f29a 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -315,8 +315,11 @@ sliceTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotatio pointerTypeDeclaration :: Assignment pointerTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeIdentifier <*> pointerType) +typeIdentifierDeclaration :: Assignment +typeIdentifierDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeIdentifier <*> expression) + typeDeclaration :: Assignment -typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children (many ( arrayTypeDeclaration +typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children (many ( arrayTypeDeclaration <|> channelTypeDeclaration <|> functionTypeDeclaration <|> interfaceTypeDeclaration @@ -324,7 +327,8 @@ typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children <|> pointerTypeDeclaration <|> sliceTypeDeclaration <|> structTypeDeclaration - <|> mapTypeDeclaration )) + <|> mapTypeDeclaration + <|> typeIdentifierDeclaration )) -- Expressions From 2b7feb3c8be8d50adae4136f589c398fb61b4e7a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 15:12:12 -0700 Subject: [PATCH 113/176] Update type conversion expressions tests --- .../type-conversion-expressions.diffA-B.txt | 43 ++++++++++++++++++- .../type-conversion-expressions.diffB-A.txt | 43 ++++++++++++++++++- .../go/type-conversion-expressions.parseA.txt | 30 ++++++++++++- .../go/type-conversion-expressions.parseB.txt | 30 ++++++++++++- 4 files changed, 142 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/type-conversion-expressions.diffA-B.txt b/test/fixtures/go/type-conversion-expressions.diffA-B.txt index e31b62159..223db4a7a 100644 --- a/test/fixtures/go/type-conversion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-conversion-expressions.diffA-B.txt @@ -1,4 +1,45 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (TypeConversion + (Slice + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (TypeConversion + { (Identifier) + ->(Identifier) } + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) } + (Empty)) + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) } + (Empty))))) diff --git a/test/fixtures/go/type-conversion-expressions.diffB-A.txt b/test/fixtures/go/type-conversion-expressions.diffB-A.txt index e31b62159..223db4a7a 100644 --- a/test/fixtures/go/type-conversion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-conversion-expressions.diffB-A.txt @@ -1,4 +1,45 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (TypeConversion + (Slice + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (TypeConversion + { (Identifier) + ->(Identifier) } + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) } + (Empty)) + (Call + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + { (Identifier) + ->(Identifier) } + (Empty))))) diff --git a/test/fixtures/go/type-conversion-expressions.parseA.txt b/test/fixtures/go/type-conversion-expressions.parseA.txt index e31b62159..8932a2f6a 100644 --- a/test/fixtures/go/type-conversion-expressions.parseA.txt +++ b/test/fixtures/go/type-conversion-expressions.parseA.txt @@ -1,4 +1,32 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (TypeConversion + (Slice + (MemberAccess + (Identifier) + (Identifier))) + (MemberAccess + (Identifier) + (Identifier))) + (TypeConversion + (Identifier) + (MemberAccess + (Identifier) + (Identifier))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Identifier) + (Empty)) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Identifier) + (Empty))))) diff --git a/test/fixtures/go/type-conversion-expressions.parseB.txt b/test/fixtures/go/type-conversion-expressions.parseB.txt index e31b62159..8932a2f6a 100644 --- a/test/fixtures/go/type-conversion-expressions.parseB.txt +++ b/test/fixtures/go/type-conversion-expressions.parseB.txt @@ -1,4 +1,32 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + ( + (TypeConversion + (Slice + (MemberAccess + (Identifier) + (Identifier))) + (MemberAccess + (Identifier) + (Identifier))) + (TypeConversion + (Identifier) + (MemberAccess + (Identifier) + (Identifier))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Identifier) + (Empty)) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Identifier) + (Empty))))) From 97f10bd358c87e665a37289b1ecc22930fe9c9e8 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 15:12:25 -0700 Subject: [PATCH 114/176] Update unary expressions tests --- test/fixtures/go/unary-expressions.diffA-B.txt | 6 +++++- test/fixtures/go/unary-expressions.diffB-A.txt | 6 +++++- test/fixtures/go/unary-expressions.parseA.txt | 5 ++++- test/fixtures/go/unary-expressions.parseB.txt | 5 ++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/unary-expressions.diffA-B.txt b/test/fixtures/go/unary-expressions.diffA-B.txt index 20a844503..3a5c7665c 100644 --- a/test/fixtures/go/unary-expressions.diffA-B.txt +++ b/test/fixtures/go/unary-expressions.diffA-B.txt @@ -8,4 +8,8 @@ (Not { (Identifier) ->(Identifier) }) - (Error)))) + (Pointer + (Call + { (Identifier) + ->(Identifier) } + (Empty)))))) diff --git a/test/fixtures/go/unary-expressions.diffB-A.txt b/test/fixtures/go/unary-expressions.diffB-A.txt index 20a844503..3a5c7665c 100644 --- a/test/fixtures/go/unary-expressions.diffB-A.txt +++ b/test/fixtures/go/unary-expressions.diffB-A.txt @@ -8,4 +8,8 @@ (Not { (Identifier) ->(Identifier) }) - (Error)))) + (Pointer + (Call + { (Identifier) + ->(Identifier) } + (Empty)))))) diff --git a/test/fixtures/go/unary-expressions.parseA.txt b/test/fixtures/go/unary-expressions.parseA.txt index bb1435bf7..51c2d0f9b 100644 --- a/test/fixtures/go/unary-expressions.parseA.txt +++ b/test/fixtures/go/unary-expressions.parseA.txt @@ -7,4 +7,7 @@ ( (Not (Identifier)) - (Error)))) + (Pointer + (Call + (Identifier) + (Empty)))))) diff --git a/test/fixtures/go/unary-expressions.parseB.txt b/test/fixtures/go/unary-expressions.parseB.txt index bb1435bf7..51c2d0f9b 100644 --- a/test/fixtures/go/unary-expressions.parseB.txt +++ b/test/fixtures/go/unary-expressions.parseB.txt @@ -7,4 +7,7 @@ ( (Not (Identifier)) - (Error)))) + (Pointer + (Call + (Identifier) + (Empty)))))) From 436a66b8b79bf225d9c5c19a563670ecdf92a7e8 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 15:14:25 -0700 Subject: [PATCH 115/176] Update type declarations tests --- .../fixtures/go/type-declarations.diffA-B.txt | 19 +++++++++++++++++-- .../fixtures/go/type-declarations.diffB-A.txt | 19 +++++++++++++++++-- test/fixtures/go/type-declarations.parseA.txt | 13 +++++++++++-- test/fixtures/go/type-declarations.parseB.txt | 13 +++++++++++-- 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/type-declarations.diffA-B.txt b/test/fixtures/go/type-declarations.diffA-B.txt index 82fb62cfe..b8acd1ecf 100644 --- a/test/fixtures/go/type-declarations.diffA-B.txt +++ b/test/fixtures/go/type-declarations.diffA-B.txt @@ -5,5 +5,20 @@ (Empty) (Identifier) ( - (Error) - (Error)))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + ( + (Annotation + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Annotation + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))))) diff --git a/test/fixtures/go/type-declarations.diffB-A.txt b/test/fixtures/go/type-declarations.diffB-A.txt index 82fb62cfe..b8acd1ecf 100644 --- a/test/fixtures/go/type-declarations.diffB-A.txt +++ b/test/fixtures/go/type-declarations.diffB-A.txt @@ -5,5 +5,20 @@ (Empty) (Identifier) ( - (Error) - (Error)))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) + ( + (Annotation + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (Annotation + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))))) diff --git a/test/fixtures/go/type-declarations.parseA.txt b/test/fixtures/go/type-declarations.parseA.txt index 82fb62cfe..b5e290f99 100644 --- a/test/fixtures/go/type-declarations.parseA.txt +++ b/test/fixtures/go/type-declarations.parseA.txt @@ -5,5 +5,14 @@ (Empty) (Identifier) ( - (Error) - (Error)))) + ( + (Annotation + (Identifier) + (Identifier))) + ( + (Annotation + (Identifier) + (Identifier)) + (Annotation + (Identifier) + (Identifier)))))) diff --git a/test/fixtures/go/type-declarations.parseB.txt b/test/fixtures/go/type-declarations.parseB.txt index 82fb62cfe..b5e290f99 100644 --- a/test/fixtures/go/type-declarations.parseB.txt +++ b/test/fixtures/go/type-declarations.parseB.txt @@ -5,5 +5,14 @@ (Empty) (Identifier) ( - (Error) - (Error)))) + ( + (Annotation + (Identifier) + (Identifier))) + ( + (Annotation + (Identifier) + (Identifier)) + (Annotation + (Identifier) + (Identifier)))))) From 4d903dbb905a599af4b6f5d03dc4e2677494dd8a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 16:35:14 -0700 Subject: [PATCH 116/176] Bump haskell-tree-sitter --- vendor/haskell-tree-sitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index e38fa5c33..507ff7915 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit e38fa5c33d214cb633e4bb9183abe93b845bf2c8 +Subproject commit 507ff79150f5f26b74687a7900c681b22b80ba48 From cbd0b71ee3b4238650c6b7086cdfbc54b4c1988c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 17:11:20 -0700 Subject: [PATCH 117/176] :fire: DefaultCommunication constructor --- src/Language/Go/Syntax.hs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index c4044bb84..0da63aa4e 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -90,14 +90,6 @@ instance Eq1 Communication where liftEq = genericLiftEq instance Ord1 Communication where liftCompare = genericLiftCompare instance Show1 Communication where liftShowsPrec = genericLiftShowsPrec --- | A default communication case in a Go select statement. -data DefaultCommunication a = DefaultCommunication - deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) - -instance Eq1 DefaultCommunication where liftEq = genericLiftEq -instance Ord1 DefaultCommunication where liftCompare = genericLiftCompare -instance Show1 DefaultCommunication where liftShowsPrec = genericLiftShowsPrec - -- | A receive statement in Go (e.g. `value = <-channel` ) data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From d662655988d724829d5103b12826ab79e0f121be Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 17:11:38 -0700 Subject: [PATCH 118/176] Unify default cases for various switch / select statements to one syntax --- src/Language/Go/Assignment.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 0c117f29a..7f93c3dd4 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -42,7 +42,6 @@ type Syntax = , Statement.PostIncrement , Expression.MemberAccess , Go.Syntax.Communication - , Go.Syntax.DefaultCommunication , Go.Syntax.DefaultPattern , Go.Syntax.Defer , Go.Syntax.Field @@ -395,11 +394,11 @@ block = symbol Block *> children expressions expressionCase :: Assignment expressionCase = makeTerm <$> symbol ExpressionCase <*> (Statement.Pattern <$> children expressions <*> expressions) -defaultExpressionCase :: Assignment -defaultExpressionCase = makeTerm <$> symbol DefaultExpressionCase <* source <*> (Go.Syntax.DefaultPattern <$> expressions) +defaultCase :: Assignment +defaultCase = makeTerm <$> symbol DefaultCase <*> children (Go.Syntax.DefaultPattern <$> expressions) expressionCaseClause :: Assignment -expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultExpressionCase) +expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultCase) expressionSwitchStatement :: Assignment expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> children (Statement.Match <$> (expression <|> emptyTerm) <*> (expressionCaseClauses <|> emptyTerm)) @@ -566,10 +565,9 @@ selectStatement :: Assignment selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) communicationClause :: Assignment -communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Go.Syntax.Communication <$> (communicationCase <|> defaultCommunicationCase) <*> expression) +communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Go.Syntax.Communication <$> (communicationCase <|> defaultCase) <*> expression) where communicationCase = symbol CommunicationCase *> children expression - defaultCommunicationCase = makeTerm <$> symbol DefaultCommunicationCase <*> (Go.Syntax.DefaultCommunication <$ source) -- Helpers From ba5be778ad95d96d1e2e735de306fe0216a067a2 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Fri, 3 Nov 2017 17:11:51 -0700 Subject: [PATCH 119/176] Update select statements tests --- test/fixtures/go/select-statements.diffA-B.txt | 3 ++- test/fixtures/go/select-statements.diffB-A.txt | 3 ++- test/fixtures/go/select-statements.parseA.txt | 3 ++- test/fixtures/go/select-statements.parseB.txt | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 086ff4fa8..59deac7d6 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -39,6 +39,7 @@ (Integer) (Empty))) (Communication - (DefaultCommunication) + (DefaultPattern + ([])) (Return (Empty))))))) diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 086ff4fa8..59deac7d6 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -39,6 +39,7 @@ (Integer) (Empty))) (Communication - (DefaultCommunication) + (DefaultPattern + ([])) (Return (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index c47efcc3a..1057d2280 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -36,6 +36,7 @@ (Integer) (Empty))) (Communication - (DefaultCommunication) + (DefaultPattern + ([])) (Return (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index c47efcc3a..1057d2280 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -36,6 +36,7 @@ (Integer) (Empty))) (Communication - (DefaultCommunication) + (DefaultPattern + ([])) (Return (Empty))))))) From a7f461298b62f704dc3862b8f00e9400dcab9b3e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 15:50:24 -0800 Subject: [PATCH 120/176] Separate default expression cases --- src/Language/Go/Assignment.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 7f93c3dd4..5bbe2e1be 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -395,10 +395,13 @@ expressionCase :: Assignment expressionCase = makeTerm <$> symbol ExpressionCase <*> (Statement.Pattern <$> children expressions <*> expressions) defaultCase :: Assignment -defaultCase = makeTerm <$> symbol DefaultCase <*> children (Go.Syntax.DefaultPattern <$> expressions) +defaultCase = makeTerm <$> symbol DefaultCase <*> children (Go.Syntax.DefaultPattern <$> (expressions <|> emptyTerm)) + +defaultExpressionCase :: Assignment +defaultExpressionCase = makeTerm <$> symbol DefaultCase <*> (Go.Syntax.DefaultPattern <$ source <*> (expressions <|> emptyTerm)) expressionCaseClause :: Assignment -expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultCase) +expressionCaseClause = symbol ExpressionCaseClause *> children (expressionCase <|> defaultExpressionCase) expressionSwitchStatement :: Assignment expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> children (Statement.Match <$> (expression <|> emptyTerm) <*> (expressionCaseClauses <|> emptyTerm)) From 9e6544a53a59c597dc760c3dfd2ea77e942bff37 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:56:15 -0800 Subject: [PATCH 121/176] Add TypeSwitch constructor --- src/Language/Go/Syntax.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 0da63aa4e..3d680ee5e 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -84,11 +84,16 @@ instance Show1 Select where liftShowsPrec = genericLiftShowsPrec -- | A communication clause in a Go select statement (e.g. `select { case x := <-c: x() }` where `case x:= <-c:` is the communication subject and `x()` is the communication body). data Communication a = Communication { communicationSubject :: !a, communicationBody :: !a } +-- | A type switch statement in Go (e.g. `switch x.(type) { // cases }`). +data TypeSwitch a = TypeSwitch { typeSwitchSubject :: !a, typeSwitchCases :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) instance Eq1 Communication where liftEq = genericLiftEq instance Ord1 Communication where liftCompare = genericLiftCompare instance Show1 Communication where liftShowsPrec = genericLiftShowsPrec +instance Eq1 TypeSwitch where liftEq = genericLiftEq +instance Ord1 TypeSwitch where liftCompare = genericLiftCompare +instance Show1 TypeSwitch where liftShowsPrec = genericLiftShowsPrec -- | A receive statement in Go (e.g. `value = <-channel` ) data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } From beb17890542dc34de59f7d826f6a37eecc765f68 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:56:25 -0800 Subject: [PATCH 122/176] Add TypeSwitchGuard constructor --- src/Language/Go/Syntax.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 3d680ee5e..b9853a5d0 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -95,6 +95,14 @@ instance Eq1 TypeSwitch where liftEq = genericLiftEq instance Ord1 TypeSwitch where liftCompare = genericLiftCompare instance Show1 TypeSwitch where liftShowsPrec = genericLiftShowsPrec +-- | A type switch guard statement in a Go type switch statement (e.g. `switch i := x.(type) { // cases}`). +newtype TypeSwitchGuard a = TypeSwitchGuard { typeSwitchGuardSubject :: a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 TypeSwitchGuard where liftEq = genericLiftEq +instance Ord1 TypeSwitchGuard where liftCompare = genericLiftCompare +instance Show1 TypeSwitchGuard where liftShowsPrec = genericLiftShowsPrec + -- | A receive statement in Go (e.g. `value = <-channel` ) data Receive a = Receive { receiveSubject :: !a, receiveExpression :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From 74e9feddcde28bedf9335ef97f9e0439603158d3 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:56:52 -0800 Subject: [PATCH 123/176] Assign type switch guard statements --- src/Language/Go/Assignment.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 5bbe2e1be..88063abd2 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -54,6 +54,7 @@ type Syntax = , Go.Syntax.Slice , Go.Syntax.TypeAssertion , Go.Syntax.TypeConversion + , Go.Syntax.TypeSwitchGuard , Go.Syntax.Variadic , Literal.Array , Literal.Channel @@ -175,6 +176,7 @@ expressionChoices = , typeConversion , typeDeclaration , typeIdentifier + , typeSwitchGuard , unaryExpression , variadicArgument , variadicParameterDeclaration @@ -408,6 +410,8 @@ expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> ch where expressionCaseClauses = makeTerm <$> location <*> many expressionCaseClause +typeSwitchGuard :: Assignment +typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expression) fallThroughStatement :: Assignment fallThroughStatement = makeTerm <$> symbol FallthroughStatement <*> (Statement.Pattern <$> (makeTerm <$> location <*> (Syntax.Identifier <$> source)) <*> emptyTerm) From b32add6c215220c65766bd9180b72959bcf7f499 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:57:08 -0800 Subject: [PATCH 124/176] Assign type case statements --- src/Language/Go/Assignment.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 88063abd2..753f6867a 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -177,6 +177,7 @@ expressionChoices = , typeDeclaration , typeIdentifier , typeSwitchGuard + , typeCase , unaryExpression , variadicArgument , variadicParameterDeclaration @@ -412,6 +413,9 @@ expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> ch typeSwitchGuard :: Assignment typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expression) +typeCase :: Assignment +typeCase = symbol TypeCase *> children expression + fallThroughStatement :: Assignment fallThroughStatement = makeTerm <$> symbol FallthroughStatement <*> (Statement.Pattern <$> (makeTerm <$> location <*> (Syntax.Identifier <$> source)) <*> emptyTerm) From 0330349c4cc6cdc3eaa37060e7decd6e5a35cbc1 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:57:18 -0800 Subject: [PATCH 125/176] Assign type case clause statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 753f6867a..d8f800d11 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -178,6 +178,7 @@ expressionChoices = , typeIdentifier , typeSwitchGuard , typeCase + , typeCaseClause , unaryExpression , variadicArgument , variadicParameterDeclaration @@ -413,6 +414,10 @@ expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> ch typeSwitchGuard :: Assignment typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expression) + +typeCaseClause :: Assignment +typeCaseClause = makeTerm <$> symbol TypeCaseClause <*> children (Statement.Pattern <$> expression <*> expressions) + typeCase :: Assignment typeCase = symbol TypeCase *> children expression From f159e73b721f3c69b1aa67d0114717b42a4ef54a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:57:29 -0800 Subject: [PATCH 126/176] Assign type switch statements --- src/Language/Go/Assignment.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index d8f800d11..aead96645 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -176,6 +176,7 @@ expressionChoices = , typeConversion , typeDeclaration , typeIdentifier + , typeSwitchStatement , typeSwitchGuard , typeCase , typeCaseClause @@ -412,6 +413,11 @@ expressionSwitchStatement = makeTerm <$> symbol ExpressionSwitchStatement <*> ch where expressionCaseClauses = makeTerm <$> location <*> many expressionCaseClause +typeSwitchStatement :: Assignment +typeSwitchStatement = makeTerm <$> symbol TypeSwitchStatement <*> children (Go.Syntax.TypeSwitch <$> _typeSwitchSubject <*> expressions) + where + _typeSwitchSubject = makeTerm <$> location <*> manyTermsTill expression (void (symbol TypeCaseClause)) + typeSwitchGuard :: Assignment typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expression) From 3032bbef8efee9c2c198021cc8f4abb85dbe9a77 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:57:46 -0800 Subject: [PATCH 127/176] Add defaultCase to expressions choice --- src/Language/Go/Assignment.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index aead96645..3f41eff13 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -120,6 +120,7 @@ expressionChoices = , varDeclaration , varSpecification , decStatement + , defaultCase , deferStatement , element , elseClause From bebfc6d761c77cfa95dc96001c9c6f1e5b8d0a6d Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:58:15 -0800 Subject: [PATCH 128/176] Add TypeSwitch to Go Syntax Union --- src/Language/Go/Assignment.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 3f41eff13..3f317de74 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -54,6 +54,7 @@ type Syntax = , Go.Syntax.Slice , Go.Syntax.TypeAssertion , Go.Syntax.TypeConversion + , Go.Syntax.TypeSwitch , Go.Syntax.TypeSwitchGuard , Go.Syntax.Variadic , Literal.Array From a17fbb5cd9ff4714cfb7e6030ac54ac8fb6ed22e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:58:33 -0800 Subject: [PATCH 129/176] Update type switch statements tests --- test/fixtures/go/type-switch-statements.A.go | 2 +- test/fixtures/go/type-switch-statements.B.go | 4 ++- .../go/type-switch-statements.diffA-B.txt | 31 ++++++++++++++++++- .../go/type-switch-statements.diffB-A.txt | 31 ++++++++++++++++++- .../go/type-switch-statements.parseA.txt | 23 +++++++++++++- .../go/type-switch-statements.parseB.txt | 28 ++++++++++++++++- 6 files changed, 113 insertions(+), 6 deletions(-) diff --git a/test/fixtures/go/type-switch-statements.A.go b/test/fixtures/go/type-switch-statements.A.go index fd377c7a5..9db64b906 100644 --- a/test/fixtures/go/type-switch-statements.A.go +++ b/test/fixtures/go/type-switch-statements.A.go @@ -1,7 +1,7 @@ package main func main() { -switch e.(type) { +switch c := d; f.(type) { case []Person: a() case *Dog: diff --git a/test/fixtures/go/type-switch-statements.B.go b/test/fixtures/go/type-switch-statements.B.go index f5ef4d871..adcaf1deb 100644 --- a/test/fixtures/go/type-switch-statements.B.go +++ b/test/fixtures/go/type-switch-statements.B.go @@ -1,10 +1,12 @@ package main func main() { -switch b.(type) { +switch a := b; e.(type) { case []Person: a() case *Dog: break + default: + break } } diff --git a/test/fixtures/go/type-switch-statements.diffA-B.txt b/test/fixtures/go/type-switch-statements.diffA-B.txt index e31b62159..9e281b3c8 100644 --- a/test/fixtures/go/type-switch-statements.diffA-B.txt +++ b/test/fixtures/go/type-switch-statements.diffA-B.txt @@ -1,4 +1,33 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeSwitch + ( + (Assignment + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (TypeSwitchGuard + { (Identifier) + ->(Identifier) })) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))) + {+(Pattern + {+(DefaultPattern + {+([])+})+} + {+(Break + {+(Empty)+})+})+})))) diff --git a/test/fixtures/go/type-switch-statements.diffB-A.txt b/test/fixtures/go/type-switch-statements.diffB-A.txt index e31b62159..8f744ad41 100644 --- a/test/fixtures/go/type-switch-statements.diffB-A.txt +++ b/test/fixtures/go/type-switch-statements.diffB-A.txt @@ -1,4 +1,33 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeSwitch + ( + (Assignment + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (TypeSwitchGuard + { (Identifier) + ->(Identifier) })) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))) + {-(Pattern + {-(DefaultPattern + {-([])-})-} + {-(Break + {-(Empty)-})-})-})))) diff --git a/test/fixtures/go/type-switch-statements.parseA.txt b/test/fixtures/go/type-switch-statements.parseA.txt index e31b62159..d54744e9e 100644 --- a/test/fixtures/go/type-switch-statements.parseA.txt +++ b/test/fixtures/go/type-switch-statements.parseA.txt @@ -1,4 +1,25 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeSwitch + ( + (Assignment + (Identifier) + (Identifier)) + (TypeSwitchGuard + (Identifier))) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))))))) diff --git a/test/fixtures/go/type-switch-statements.parseB.txt b/test/fixtures/go/type-switch-statements.parseB.txt index e31b62159..bd15360c4 100644 --- a/test/fixtures/go/type-switch-statements.parseB.txt +++ b/test/fixtures/go/type-switch-statements.parseB.txt @@ -1,4 +1,30 @@ (Program (Module (Identifier)) - (Error)) + (Function + (Empty) + (Identifier) + (TypeSwitch + ( + (Assignment + (Identifier) + (Identifier)) + (TypeSwitchGuard + (Identifier))) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))) + (Pattern + (DefaultPattern + ([])) + (Break + (Empty))))))) From 2ca942a9e8f2a285bb96a4829789264708273dda Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 16:59:42 -0800 Subject: [PATCH 130/176] :fire: Communication constructor - We can use Statement.Pattern, because the parent is a Go.Syntax.Select syntax. Because we have the parent context in the parse tree, adding a separate constructor for the case is unnecessary. --- src/Language/Go/Syntax.hs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index b9853a5d0..0e0c60018 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -82,15 +82,10 @@ instance Eq1 Select where liftEq = genericLiftEq instance Ord1 Select where liftCompare = genericLiftCompare instance Show1 Select where liftShowsPrec = genericLiftShowsPrec --- | A communication clause in a Go select statement (e.g. `select { case x := <-c: x() }` where `case x:= <-c:` is the communication subject and `x()` is the communication body). -data Communication a = Communication { communicationSubject :: !a, communicationBody :: !a } -- | A type switch statement in Go (e.g. `switch x.(type) { // cases }`). data TypeSwitch a = TypeSwitch { typeSwitchSubject :: !a, typeSwitchCases :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) -instance Eq1 Communication where liftEq = genericLiftEq -instance Ord1 Communication where liftCompare = genericLiftCompare -instance Show1 Communication where liftShowsPrec = genericLiftShowsPrec instance Eq1 TypeSwitch where liftEq = genericLiftEq instance Ord1 TypeSwitch where liftCompare = genericLiftCompare instance Show1 TypeSwitch where liftShowsPrec = genericLiftShowsPrec From 1cdd847e16e8af034e5d2c6cefea33156f686b2d Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 17:00:04 -0800 Subject: [PATCH 131/176] Use Statement.Pattern in place of Go.Syntax.Communication --- src/Language/Go/Assignment.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 3f317de74..7f9135d3e 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -41,7 +41,6 @@ type Syntax = , Statement.PostDecrement , Statement.PostIncrement , Expression.MemberAccess - , Go.Syntax.Communication , Go.Syntax.DefaultPattern , Go.Syntax.Defer , Go.Syntax.Field @@ -589,7 +588,7 @@ selectStatement :: Assignment selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) communicationClause :: Assignment -communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Go.Syntax.Communication <$> (communicationCase <|> defaultCase) <*> expression) +communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Statement.Pattern <$> (communicationCase <|> defaultCase) <*> expression) where communicationCase = symbol CommunicationCase *> children expression From 15e9f7b4533f07ba7e801405b3a5192c8b32d4e1 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 17:00:20 -0800 Subject: [PATCH 132/176] Update select statements tests --- test/fixtures/go/select-statements.diffA-B.txt | 8 ++++---- test/fixtures/go/select-statements.diffB-A.txt | 8 ++++---- test/fixtures/go/select-statements.parseA.txt | 8 ++++---- test/fixtures/go/select-statements.parseB.txt | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 59deac7d6..9697bd477 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -6,7 +6,7 @@ (Identifier) (Select ( - (Communication + (Pattern (Receive { (Identifier) ->(Identifier) } @@ -15,7 +15,7 @@ (Identifier) (Identifier) (Empty))) - (Communication + (Pattern (Send { (Identifier) ->(Identifier) } @@ -24,7 +24,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (Receive (Empty) (Call @@ -38,7 +38,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (DefaultPattern ([])) (Return diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 59deac7d6..9697bd477 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -6,7 +6,7 @@ (Identifier) (Select ( - (Communication + (Pattern (Receive { (Identifier) ->(Identifier) } @@ -15,7 +15,7 @@ (Identifier) (Identifier) (Empty))) - (Communication + (Pattern (Send { (Identifier) ->(Identifier) } @@ -24,7 +24,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (Receive (Empty) (Call @@ -38,7 +38,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (DefaultPattern ([])) (Return diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index 1057d2280..1a6350cbb 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -6,7 +6,7 @@ (Identifier) (Select ( - (Communication + (Pattern (Receive (Identifier) (Identifier)) @@ -14,7 +14,7 @@ (Identifier) (Identifier) (Empty))) - (Communication + (Pattern (Send (Identifier) (Identifier)) @@ -22,7 +22,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (Receive (Empty) (Call @@ -35,7 +35,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (DefaultPattern ([])) (Return diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index 1057d2280..1a6350cbb 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -6,7 +6,7 @@ (Identifier) (Select ( - (Communication + (Pattern (Receive (Identifier) (Identifier)) @@ -14,7 +14,7 @@ (Identifier) (Identifier) (Empty))) - (Communication + (Pattern (Send (Identifier) (Identifier)) @@ -22,7 +22,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (Receive (Empty) (Call @@ -35,7 +35,7 @@ (Identifier) (Integer) (Empty))) - (Communication + (Pattern (DefaultPattern ([])) (Return From 4ad10b6bf7b46c9220fc45323186b95898a2dc04 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Mon, 6 Nov 2017 17:00:42 -0800 Subject: [PATCH 133/176] Add newline --- src/Language/Go/Assignment.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 7f9135d3e..f8e914276 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -592,6 +592,7 @@ communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Stat where communicationCase = symbol CommunicationCase *> children expression + -- Helpers -- | Match infix terms separated by any of a list of operators, assigning any comments following each operand. From 0ea1643cb90ba4d645d97d61197d1dde4b90a93f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 10:01:23 -0800 Subject: [PATCH 134/176] Assign empty statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index f8e914276..98457ff21 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -75,6 +75,7 @@ type Syntax = , Statement.Goto , Statement.If , Statement.Match + , Statement.NoOp , Statement.Pattern , Statement.Return , Syntax.Context @@ -124,6 +125,7 @@ expressionChoices = , deferStatement , element , elseClause + , emptyStatement , expressionCaseClause , expressionList , expressionSwitchStatement @@ -518,6 +520,9 @@ assignment' = makeTerm' <$> symbol AssignmentStatement <*> children (infixTerm invert cons a b = Expression.Not (makeTerm1 (cons a b)) +emptyStatement :: Assignment +emptyStatement = makeTerm <$> token EmptyStatement <*> (Statement.NoOp <$> emptyTerm) + shortVarDeclaration :: Assignment shortVarDeclaration = makeTerm <$> symbol ShortVarDeclaration <*> children (Statement.Assignment <$> pure [] <*> expression <*> expression) From cccedef52d2b855e5fb1d44a640c7011fbd3345f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 10:14:46 -0800 Subject: [PATCH 135/176] Add empty statement example in tests --- test/fixtures/go/function-declarations.B.go | 1 + test/fixtures/go/function-declarations.diffA-B.txt | 7 ++++++- test/fixtures/go/function-declarations.diffB-A.txt | 7 ++++++- test/fixtures/go/function-declarations.parseB.txt | 7 ++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/test/fixtures/go/function-declarations.B.go b/test/fixtures/go/function-declarations.B.go index 750f37ab6..a20e14bfb 100644 --- a/test/fixtures/go/function-declarations.B.go +++ b/test/fixtures/go/function-declarations.B.go @@ -5,3 +5,4 @@ func fa() {} func fb(a int, b, c, d string) int {} func fc() (int, error) {} func fd() (result int, err error) {} +func fe() () {;} diff --git a/test/fixtures/go/function-declarations.diffA-B.txt b/test/fixtures/go/function-declarations.diffA-B.txt index c362c5815..802086fae 100644 --- a/test/fixtures/go/function-declarations.diffA-B.txt +++ b/test/fixtures/go/function-declarations.diffA-B.txt @@ -40,4 +40,9 @@ (Identifier))) { (Identifier) ->(Identifier) } - ([]))) + ([])) +{+(Function + {+([])+} + {+(Identifier)+} + {+(NoOp + {+(Empty)+})+})+}) diff --git a/test/fixtures/go/function-declarations.diffB-A.txt b/test/fixtures/go/function-declarations.diffB-A.txt index c362c5815..227c603f7 100644 --- a/test/fixtures/go/function-declarations.diffB-A.txt +++ b/test/fixtures/go/function-declarations.diffB-A.txt @@ -40,4 +40,9 @@ (Identifier))) { (Identifier) ->(Identifier) } - ([]))) + ([])) +{-(Function + {-([])-} + {-(Identifier)-} + {-(NoOp + {-(Empty)-})-})-}) diff --git a/test/fixtures/go/function-declarations.parseB.txt b/test/fixtures/go/function-declarations.parseB.txt index cd1a10acb..15c971852 100644 --- a/test/fixtures/go/function-declarations.parseB.txt +++ b/test/fixtures/go/function-declarations.parseB.txt @@ -36,4 +36,9 @@ (Identifier) (Identifier))) (Identifier) - ([]))) + ([])) + (Function + ([]) + (Identifier) + (NoOp + (Empty)))) From c8c8b8ee20cc8baca082ff8d94fa51242d8fdb12 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 10:27:57 -0800 Subject: [PATCH 136/176] Update comment --- src/Language/Go/Syntax.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 0e0c60018..78ae3d009 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -34,7 +34,7 @@ instance Eq1 RuneLiteral where liftEq = genericLiftEq instance Ord1 RuneLiteral where liftCompare = genericLiftCompare instance Show1 RuneLiteral where liftShowsPrec = genericLiftShowsPrec --- | A labeled statement in Go (e.g. `label:continue`). +-- | A label statement in Go (e.g. `label:continue`). data Label a = Label { labelName :: !a, labelStatement :: !a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From 7de725c9c83f7a100d8f0b31be075379c4b2fceb Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 11:18:43 -0800 Subject: [PATCH 137/176] Assign unary receive as a Recieve syntax --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 98457ff21..880bc5965 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -369,7 +369,7 @@ unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression locati unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) unaryPlus = children (symbol AnonPlus *> expression) unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Literal.Reference <$> expression)) - unaryReceive = children (symbol AnonLAngleMinus *> expression) + unaryReceive = children (makeTerm <$> symbol AnonLAngleMinus <*> (Go.Syntax.Receive <$> emptyTerm <*> expression)) unaryPointer = children (makeTerm <$> symbol AnonStar <*> (Literal.Pointer <$> expression)) binaryExpression :: Assignment From a21c1681d17124fbb368f2fb34ad526242e263d0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 11:20:25 -0800 Subject: [PATCH 138/176] Update select statements tests --- .../fixtures/go/select-statements.diffA-B.txt | 20 +++++++++++-------- .../fixtures/go/select-statements.diffB-A.txt | 20 +++++++++++-------- test/fixtures/go/select-statements.parseA.txt | 18 ++++++++++------- test/fixtures/go/select-statements.parseB.txt | 18 ++++++++++------- 4 files changed, 46 insertions(+), 30 deletions(-) diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 9697bd477..821631b38 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -10,7 +10,9 @@ (Receive { (Identifier) ->(Identifier) } - (Identifier)) + (Receive + (Empty) + (Identifier))) (Call (Identifier) (Identifier) @@ -27,13 +29,15 @@ (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - { (Integer) - ->(Integer) } - (Empty))) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (Integer) + ->(Integer) } + (Empty)))) (Call (Identifier) (Integer) diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 9697bd477..821631b38 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -10,7 +10,9 @@ (Receive { (Identifier) ->(Identifier) } - (Identifier)) + (Receive + (Empty) + (Identifier))) (Call (Identifier) (Identifier) @@ -27,13 +29,15 @@ (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - { (Integer) - ->(Integer) } - (Empty))) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (Integer) + ->(Integer) } + (Empty)))) (Call (Identifier) (Integer) diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index 1a6350cbb..e11b4060b 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -9,7 +9,9 @@ (Pattern (Receive (Identifier) - (Identifier)) + (Receive + (Empty) + (Identifier))) (Call (Identifier) (Identifier) @@ -25,12 +27,14 @@ (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty))) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty)))) (Call (Identifier) (Integer) diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index 1a6350cbb..e11b4060b 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -9,7 +9,9 @@ (Pattern (Receive (Identifier) - (Identifier)) + (Receive + (Empty) + (Identifier))) (Call (Identifier) (Identifier) @@ -25,12 +27,14 @@ (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty))) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty)))) (Call (Identifier) (Integer) From f060df748c77fac5056abba160fa0692e5b8e9de Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 11:20:36 -0800 Subject: [PATCH 139/176] Select unary expressions tests --- test/fixtures/go/unary-expressions.diffA-B.txt | 6 ++++-- test/fixtures/go/unary-expressions.diffB-A.txt | 6 ++++-- test/fixtures/go/unary-expressions.parseA.txt | 4 +++- test/fixtures/go/unary-expressions.parseB.txt | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/test/fixtures/go/unary-expressions.diffA-B.txt b/test/fixtures/go/unary-expressions.diffA-B.txt index 3a5c7665c..4c795ea20 100644 --- a/test/fixtures/go/unary-expressions.diffA-B.txt +++ b/test/fixtures/go/unary-expressions.diffA-B.txt @@ -6,8 +6,10 @@ (Identifier) ( (Not - { (Identifier) - ->(Identifier) }) + (Receive + (Empty) + { (Identifier) + ->(Identifier) })) (Pointer (Call { (Identifier) diff --git a/test/fixtures/go/unary-expressions.diffB-A.txt b/test/fixtures/go/unary-expressions.diffB-A.txt index 3a5c7665c..4c795ea20 100644 --- a/test/fixtures/go/unary-expressions.diffB-A.txt +++ b/test/fixtures/go/unary-expressions.diffB-A.txt @@ -6,8 +6,10 @@ (Identifier) ( (Not - { (Identifier) - ->(Identifier) }) + (Receive + (Empty) + { (Identifier) + ->(Identifier) })) (Pointer (Call { (Identifier) diff --git a/test/fixtures/go/unary-expressions.parseA.txt b/test/fixtures/go/unary-expressions.parseA.txt index 51c2d0f9b..d0c9012f0 100644 --- a/test/fixtures/go/unary-expressions.parseA.txt +++ b/test/fixtures/go/unary-expressions.parseA.txt @@ -6,7 +6,9 @@ (Identifier) ( (Not - (Identifier)) + (Receive + (Empty) + (Identifier))) (Pointer (Call (Identifier) diff --git a/test/fixtures/go/unary-expressions.parseB.txt b/test/fixtures/go/unary-expressions.parseB.txt index 51c2d0f9b..d0c9012f0 100644 --- a/test/fixtures/go/unary-expressions.parseB.txt +++ b/test/fixtures/go/unary-expressions.parseB.txt @@ -6,7 +6,9 @@ (Identifier) ( (Not - (Identifier)) + (Receive + (Empty) + (Identifier))) (Pointer (Call (Identifier) From 410bb390fcda98c84f338f37929f8ea8ba70663c Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 13:31:17 -0800 Subject: [PATCH 140/176] Add ParenthesizedType constructor --- src/Language/Go/Syntax.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 78ae3d009..a320a8e78 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -128,3 +128,10 @@ data TypeConversion a = TypeConversion { typeConversionType :: !a, typeConversio instance Eq1 TypeConversion where liftEq = genericLiftEq instance Ord1 TypeConversion where liftCompare = genericLiftCompare instance Show1 TypeConversion where liftShowsPrec = genericLiftShowsPrec + +newtype ParenthesizedType a = ParenthesizedType a + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 ParenthesizedType where liftEq = genericLiftEq +instance Ord1 ParenthesizedType where liftCompare = genericLiftCompare +instance Show1 ParenthesizedType where liftShowsPrec = genericLiftShowsPrec From 88edf93a782273d49bcb9c54b9afd474415718d0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 13:31:29 -0800 Subject: [PATCH 141/176] Update parenthesizedType assignment --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 880bc5965..adbfe6f3c 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -46,6 +46,7 @@ type Syntax = , Go.Syntax.Field , Go.Syntax.Go , Go.Syntax.Label + , Go.Syntax.ParenthesizedType , Go.Syntax.Receive , Go.Syntax.RuneLiteral , Go.Syntax.Select @@ -235,7 +236,7 @@ packageIdentifier :: Assignment packageIdentifier = makeTerm <$> symbol PackageIdentifier <*> (Syntax.Identifier <$> source) parenthesizedType :: Assignment -parenthesizedType = makeTerm <$> symbol ParenthesizedType <*> (Syntax.Identifier <$> source) +parenthesizedType = makeTerm <$> symbol Grammar.ParenthesizedType <*> children (Go.Syntax.ParenthesizedType <$> expression) interpretedStringLiteral :: Assignment interpretedStringLiteral = makeTerm <$> symbol InterpretedStringLiteral <*> (Literal.TextElement <$> source) From 155e0e05eb12ff433ece012e1fdeb29161fdf638 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 13:31:44 -0800 Subject: [PATCH 142/176] Update type conversion expressions tests --- test/fixtures/go/type-conversion-expressions.diffA-B.txt | 9 +++++++-- test/fixtures/go/type-conversion-expressions.diffB-A.txt | 9 +++++++-- test/fixtures/go/type-conversion-expressions.parseA.txt | 6 +++++- test/fixtures/go/type-conversion-expressions.parseB.txt | 6 +++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/test/fixtures/go/type-conversion-expressions.diffA-B.txt b/test/fixtures/go/type-conversion-expressions.diffA-B.txt index 223db4a7a..6f401c55d 100644 --- a/test/fixtures/go/type-conversion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-conversion-expressions.diffA-B.txt @@ -18,8 +18,13 @@ { (Identifier) ->(Identifier) })) (TypeConversion - { (Identifier) - ->(Identifier) } + (ParenthesizedType + (Slice + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))) (MemberAccess { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/type-conversion-expressions.diffB-A.txt b/test/fixtures/go/type-conversion-expressions.diffB-A.txt index 223db4a7a..6f401c55d 100644 --- a/test/fixtures/go/type-conversion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-conversion-expressions.diffB-A.txt @@ -18,8 +18,13 @@ { (Identifier) ->(Identifier) })) (TypeConversion - { (Identifier) - ->(Identifier) } + (ParenthesizedType + (Slice + (MemberAccess + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))) (MemberAccess { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/type-conversion-expressions.parseA.txt b/test/fixtures/go/type-conversion-expressions.parseA.txt index 8932a2f6a..fa2781a93 100644 --- a/test/fixtures/go/type-conversion-expressions.parseA.txt +++ b/test/fixtures/go/type-conversion-expressions.parseA.txt @@ -14,7 +14,11 @@ (Identifier) (Identifier))) (TypeConversion - (Identifier) + (ParenthesizedType + (Slice + (MemberAccess + (Identifier) + (Identifier)))) (MemberAccess (Identifier) (Identifier))) diff --git a/test/fixtures/go/type-conversion-expressions.parseB.txt b/test/fixtures/go/type-conversion-expressions.parseB.txt index 8932a2f6a..fa2781a93 100644 --- a/test/fixtures/go/type-conversion-expressions.parseB.txt +++ b/test/fixtures/go/type-conversion-expressions.parseB.txt @@ -14,7 +14,11 @@ (Identifier) (Identifier))) (TypeConversion - (Identifier) + (ParenthesizedType + (Slice + (MemberAccess + (Identifier) + (Identifier)))) (MemberAccess (Identifier) (Identifier))) From 7bc345906f824c20502bd4faff8283eadc0608a7 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 15:48:26 -0800 Subject: [PATCH 143/176] Add Type.Alias constructor --- src/Data/Syntax/Type.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Data/Syntax/Type.hs b/src/Data/Syntax/Type.hs index ba6a51186..b6fb31ad9 100644 --- a/src/Data/Syntax/Type.hs +++ b/src/Data/Syntax/Type.hs @@ -16,6 +16,13 @@ instance Eq1 Annotation where liftEq = genericLiftEq instance Ord1 Annotation where liftCompare = genericLiftCompare instance Show1 Annotation where liftShowsPrec = genericLiftShowsPrec +data Alias a = Alias { aliasSubject :: !a, aliasType :: !a } + deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) + +instance Eq1 Alias where liftEq = genericLiftEq +instance Ord1 Alias where liftCompare = genericLiftCompare +instance Show1 Alias where liftShowsPrec = genericLiftShowsPrec + data Function a = Function { functionParameters :: [a], functionReturn :: a } deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable) From fce6296369c61c43450d29d15eed9086e78666f6 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 15:48:41 -0800 Subject: [PATCH 144/176] Assign type alias statements --- src/Language/Go/Assignment.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index adbfe6f3c..ae12b98f9 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -84,6 +84,7 @@ type Syntax = , Syntax.Empty , Syntax.Identifier , Syntax.Program + , Type.Alias , Type.Annotation , Type.Array , Type.BiDirectionalChannel @@ -323,6 +324,9 @@ sliceTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotatio pointerTypeDeclaration :: Assignment pointerTypeDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeIdentifier <*> pointerType) +typeAlias :: Assignment +typeAlias = makeTerm <$> symbol TypeAlias <*> children (Type.Alias <$> expression <*> expression) + typeIdentifierDeclaration :: Assignment typeIdentifierDeclaration = makeTerm <$> symbol TypeSpec <*> children (Type.Annotation <$> typeIdentifier <*> expression) @@ -336,6 +340,7 @@ typeDeclaration = handleError $ makeTerm <$> symbol TypeDeclaration <*> children <|> sliceTypeDeclaration <|> structTypeDeclaration <|> mapTypeDeclaration + <|> typeAlias <|> typeIdentifierDeclaration )) From d62d475bf74d27a2de3e1f2f1c275d8456062417 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:00:10 -0800 Subject: [PATCH 145/176] Add type-aliases tests --- test/fixtures/go/type-aliases.A.go | 8 ++++++++ test/fixtures/go/type-aliases.B.go | 8 ++++++++ test/fixtures/go/type-aliases.diffA-B.txt | 18 ++++++++++++++++++ test/fixtures/go/type-aliases.diffB-A.txt | 18 ++++++++++++++++++ test/fixtures/go/type-aliases.parseA.txt | 15 +++++++++++++++ test/fixtures/go/type-aliases.parseB.txt | 15 +++++++++++++++ 6 files changed, 82 insertions(+) create mode 100644 test/fixtures/go/type-aliases.A.go create mode 100644 test/fixtures/go/type-aliases.B.go create mode 100644 test/fixtures/go/type-aliases.diffA-B.txt create mode 100644 test/fixtures/go/type-aliases.diffB-A.txt create mode 100644 test/fixtures/go/type-aliases.parseA.txt create mode 100644 test/fixtures/go/type-aliases.parseB.txt diff --git a/test/fixtures/go/type-aliases.A.go b/test/fixtures/go/type-aliases.A.go new file mode 100644 index 000000000..c8827add1 --- /dev/null +++ b/test/fixtures/go/type-aliases.A.go @@ -0,0 +1,8 @@ +package main + +func main() { +type ( + nodeList = []*Node + Polar = polar +) +} diff --git a/test/fixtures/go/type-aliases.B.go b/test/fixtures/go/type-aliases.B.go new file mode 100644 index 000000000..3fa63e491 --- /dev/null +++ b/test/fixtures/go/type-aliases.B.go @@ -0,0 +1,8 @@ +package main + +func main() { +type ( + nodes = []*Node + Radian = radian +) +} diff --git a/test/fixtures/go/type-aliases.diffA-B.txt b/test/fixtures/go/type-aliases.diffA-B.txt new file mode 100644 index 000000000..8eec0068a --- /dev/null +++ b/test/fixtures/go/type-aliases.diffA-B.txt @@ -0,0 +1,18 @@ +(Program + (Module + (Identifier)) + (Function + (Empty) + (Identifier) + ( + (Alias + { (Identifier) + ->(Identifier) } + (Slice + (Pointer + (Identifier)))) + (Alias + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })))) diff --git a/test/fixtures/go/type-aliases.diffB-A.txt b/test/fixtures/go/type-aliases.diffB-A.txt new file mode 100644 index 000000000..8eec0068a --- /dev/null +++ b/test/fixtures/go/type-aliases.diffB-A.txt @@ -0,0 +1,18 @@ +(Program + (Module + (Identifier)) + (Function + (Empty) + (Identifier) + ( + (Alias + { (Identifier) + ->(Identifier) } + (Slice + (Pointer + (Identifier)))) + (Alias + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })))) diff --git a/test/fixtures/go/type-aliases.parseA.txt b/test/fixtures/go/type-aliases.parseA.txt new file mode 100644 index 000000000..b17cab8e9 --- /dev/null +++ b/test/fixtures/go/type-aliases.parseA.txt @@ -0,0 +1,15 @@ +(Program + (Module + (Identifier)) + (Function + (Empty) + (Identifier) + ( + (Alias + (Identifier) + (Slice + (Pointer + (Identifier)))) + (Alias + (Identifier) + (Identifier))))) diff --git a/test/fixtures/go/type-aliases.parseB.txt b/test/fixtures/go/type-aliases.parseB.txt new file mode 100644 index 000000000..b17cab8e9 --- /dev/null +++ b/test/fixtures/go/type-aliases.parseB.txt @@ -0,0 +1,15 @@ +(Program + (Module + (Identifier)) + (Function + (Empty) + (Identifier) + ( + (Alias + (Identifier) + (Slice + (Pointer + (Identifier)))) + (Alias + (Identifier) + (Identifier))))) From bf129739ec21235bbab6344979c5becba50604ea Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:25:35 -0800 Subject: [PATCH 146/176] Make method declaration assignment more robust --- src/Language/Go/Assignment.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ae12b98f9..80a6e22d2 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -481,8 +481,9 @@ importSpec :: Assignment importSpec = symbol ImportSpec *> children expressions methodDeclaration :: Assignment -methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> typeIdentifier <*> block) - where parameters = symbol Parameters *> children (symbol ParameterDeclaration *> children (many expression)) +methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> (typeIdentifier <|> emptyTerm) <*> block) + where parameters = symbol Parameters *> children ((symbol ParameterDeclaration *> children (many expression)) + <|> many emptyTerm) receiver = symbol Parameters *> children (symbol ParameterDeclaration *> children expressions) mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') From 99677709ed5c5ebd29020705945cd3578adbfc44 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:28:17 -0800 Subject: [PATCH 147/176] Add additional method declaration test cases --- test/fixtures/go/method-declarations.A.go | 9 ++ test/fixtures/go/method-declarations.B.go | 9 ++ .../go/method-declarations.diffA-B.txt | 88 ++++++++++++++++++- .../go/method-declarations.diffB-A.txt | 88 ++++++++++++++++++- .../go/method-declarations.parseA.txt | 59 ++++++++++++- .../go/method-declarations.parseB.txt | 71 ++++++++++++++- 6 files changed, 320 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/method-declarations.A.go b/test/fixtures/go/method-declarations.A.go index e556c0160..b8df97ef1 100644 --- a/test/fixtures/go/method-declarations.A.go +++ b/test/fixtures/go/method-declarations.A.go @@ -3,3 +3,12 @@ package main func main() {} func (self Person) Equals(other Person) bool {} + +func (p *Point) Length() float64 { + return math.Sqrt(p.x * p.x + p.y * p.y) +} + +func (p *Point) Scale(factor float64) { + p.x *= factor + p.y *= factor +} diff --git a/test/fixtures/go/method-declarations.B.go b/test/fixtures/go/method-declarations.B.go index 1be6d2054..8e685dc6d 100644 --- a/test/fixtures/go/method-declarations.B.go +++ b/test/fixtures/go/method-declarations.B.go @@ -3,3 +3,12 @@ package main func main() {} func (self Num) Equals(other Num) bool {} + +func (p *Point) OtherLength() float64 { + return math.Sqrt(math.Pow(p.x, 2) + p.x + math.Pow(p.y, 2) + p.y) +} + +func (q *Point) Scale(factor int) { + p.x *= factor + p.y *= factor +} diff --git a/test/fixtures/go/method-declarations.diffA-B.txt b/test/fixtures/go/method-declarations.diffA-B.txt index b0205bbc0..3e0f8c3e0 100644 --- a/test/fixtures/go/method-declarations.diffA-B.txt +++ b/test/fixtures/go/method-declarations.diffA-B.txt @@ -15,4 +15,90 @@ (Identifier) { (Identifier) ->(Identifier) } - ([]))) + ([])) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + { (Identifier) + ->(Identifier) } + (Empty) + (Return + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Plus + { (Times + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-}) + ->(Plus + {+(Plus + {+(Call + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(Integer)+} + {+(Empty)+})+} + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+})+} + {+(Call + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(Integer)+} + {+(Empty)+})+}) } + { (Times + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-}) + ->(MemberAccess + {+(Identifier)+} + {+(Identifier)+}) }) + (Empty)))) + (Method + (Empty) + ( + { (Identifier) + ->(Identifier) } + (Pointer + (Identifier))) + (Identifier) + (Identifier) + { (Identifier) + ->(Identifier) } + ( + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier))) + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier)))))) diff --git a/test/fixtures/go/method-declarations.diffB-A.txt b/test/fixtures/go/method-declarations.diffB-A.txt index b0205bbc0..cd861c245 100644 --- a/test/fixtures/go/method-declarations.diffB-A.txt +++ b/test/fixtures/go/method-declarations.diffB-A.txt @@ -15,4 +15,90 @@ (Identifier) { (Identifier) ->(Identifier) } - ([]))) + ([])) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + { (Identifier) + ->(Identifier) } + (Empty) + (Return + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Plus + { (Plus + {-(Plus + {-(Call + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(Integer)-} + {-(Empty)-})-} + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-})-} + {-(Call + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(MemberAccess + {-(Identifier)-} + {-(Identifier)-})-} + {-(Integer)-} + {-(Empty)-})-}) + ->(Times + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+}) } + { (MemberAccess + {-(Identifier)-} + {-(Identifier)-}) + ->(Times + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+} + {+(MemberAccess + {+(Identifier)+} + {+(Identifier)+})+}) }) + (Empty)))) + (Method + (Empty) + ( + { (Identifier) + ->(Identifier) } + (Pointer + (Identifier))) + (Identifier) + (Identifier) + { (Identifier) + ->(Identifier) } + ( + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier))) + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier)))))) diff --git a/test/fixtures/go/method-declarations.parseA.txt b/test/fixtures/go/method-declarations.parseA.txt index 44733dd8e..67eb3280f 100644 --- a/test/fixtures/go/method-declarations.parseA.txt +++ b/test/fixtures/go/method-declarations.parseA.txt @@ -13,4 +13,61 @@ (Identifier) (Identifier) (Identifier) - ([]))) + ([])) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + (Empty) + (Return + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Plus + (Times + (MemberAccess + (Identifier) + (Identifier)) + (MemberAccess + (Identifier) + (Identifier))) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (MemberAccess + (Identifier) + (Identifier)))) + (Empty)))) + (Method + (Empty) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + (Identifier) + (Identifier) + ( + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier))) + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier)))))) diff --git a/test/fixtures/go/method-declarations.parseB.txt b/test/fixtures/go/method-declarations.parseB.txt index 44733dd8e..f3b3be03b 100644 --- a/test/fixtures/go/method-declarations.parseB.txt +++ b/test/fixtures/go/method-declarations.parseB.txt @@ -13,4 +13,73 @@ (Identifier) (Identifier) (Identifier) - ([]))) + ([])) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + (Empty) + (Return + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Plus + (Plus + (Plus + (Call + (MemberAccess + (Identifier) + (Identifier)) + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty)) + (MemberAccess + (Identifier) + (Identifier))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty))) + (MemberAccess + (Identifier) + (Identifier))) + (Empty)))) + (Method + (Empty) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + (Identifier) + (Identifier) + ( + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier))) + (Assignment + (MemberAccess + (Identifier) + (Identifier)) + (Times + (MemberAccess + (Identifier) + (Identifier)) + (Identifier)))))) From 12583b435ea960c4a5a8d59c5da59a1f81ca1afd Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:38:32 -0800 Subject: [PATCH 148/176] Assign recursive array type statements --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 80a6e22d2..0c5537835 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -255,7 +255,7 @@ qualifiedType :: Assignment qualifiedType = makeTerm <$> symbol QualifiedType <*> children (Expression.MemberAccess <$> expression <*> expression) arrayType :: Assignment -arrayType = makeTerm <$> symbol ArrayType <*> children (Type.Array . Just <$> expression <*> expression) +arrayType = makeTerm <$> symbol ArrayType <*> children (Type.Array . Just <$> expression <*> (expression <|> arrayType)) implicitLengthArrayType :: Assignment implicitLengthArrayType = makeTerm <$> symbol ImplicitLengthArrayType <*> children (Type.Array Nothing <$> expression) From ad8067f5e8a4849a7dc411ba504e90e89eb50050 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:38:52 -0800 Subject: [PATCH 149/176] Add additional array types tests --- test/fixtures/go/array-types.A.go | 2 ++ test/fixtures/go/array-types.B.go | 2 ++ test/fixtures/go/array-types.diffA-B.txt | 39 +++++++++++++++++++----- test/fixtures/go/array-types.diffB-A.txt | 39 +++++++++++++++++++----- test/fixtures/go/array-types.parseA.txt | 31 +++++++++++++++---- test/fixtures/go/array-types.parseB.txt | 31 +++++++++++++++---- 6 files changed, 118 insertions(+), 26 deletions(-) diff --git a/test/fixtures/go/array-types.A.go b/test/fixtures/go/array-types.A.go index 3f73aea08..1786d35b2 100644 --- a/test/fixtures/go/array-types.A.go +++ b/test/fixtures/go/array-types.A.go @@ -2,4 +2,6 @@ package main func main() { type a [2+2]x +type b [3][5]int +type c [2][2][2]float64 } diff --git a/test/fixtures/go/array-types.B.go b/test/fixtures/go/array-types.B.go index 497831265..64e5ea2f1 100644 --- a/test/fixtures/go/array-types.B.go +++ b/test/fixtures/go/array-types.B.go @@ -2,4 +2,6 @@ package main func main() { type a [1+1]y +type d [6][9]int +type e [1][2][3]float64 } diff --git a/test/fixtures/go/array-types.diffA-B.txt b/test/fixtures/go/array-types.diffA-B.txt index f616d322b..1bdf4a4f8 100644 --- a/test/fixtures/go/array-types.diffA-B.txt +++ b/test/fixtures/go/array-types.diffA-B.txt @@ -5,13 +5,38 @@ (Empty) (Identifier) ( - (Annotation - (Identifier) - (Array - (Plus + ( + (Annotation + (Identifier) + (Array + (Plus + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) }) + { (Identifier) + ->(Identifier) }))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Array { (Integer) ->(Integer) } - { (Integer) - ->(Integer) }) + (Array + { (Integer) + ->(Integer) } + (Identifier))))) + ( + (Annotation { (Identifier) - ->(Identifier) }))))) + ->(Identifier) } + (Array + { (Integer) + ->(Integer) } + (Array + (Integer) + (Array + { (Integer) + ->(Integer) } + (Identifier))))))))) diff --git a/test/fixtures/go/array-types.diffB-A.txt b/test/fixtures/go/array-types.diffB-A.txt index f616d322b..1bdf4a4f8 100644 --- a/test/fixtures/go/array-types.diffB-A.txt +++ b/test/fixtures/go/array-types.diffB-A.txt @@ -5,13 +5,38 @@ (Empty) (Identifier) ( - (Annotation - (Identifier) - (Array - (Plus + ( + (Annotation + (Identifier) + (Array + (Plus + { (Integer) + ->(Integer) } + { (Integer) + ->(Integer) }) + { (Identifier) + ->(Identifier) }))) + ( + (Annotation + { (Identifier) + ->(Identifier) } + (Array { (Integer) ->(Integer) } - { (Integer) - ->(Integer) }) + (Array + { (Integer) + ->(Integer) } + (Identifier))))) + ( + (Annotation { (Identifier) - ->(Identifier) }))))) + ->(Identifier) } + (Array + { (Integer) + ->(Integer) } + (Array + (Integer) + (Array + { (Integer) + ->(Integer) } + (Identifier))))))))) diff --git a/test/fixtures/go/array-types.parseA.txt b/test/fixtures/go/array-types.parseA.txt index f9653b483..02dbfdd8b 100644 --- a/test/fixtures/go/array-types.parseA.txt +++ b/test/fixtures/go/array-types.parseA.txt @@ -5,10 +5,29 @@ (Empty) (Identifier) ( - (Annotation - (Identifier) - (Array - (Plus + ( + (Annotation + (Identifier) + (Array + (Plus + (Integer) + (Integer)) + (Identifier)))) + ( + (Annotation + (Identifier) + (Array (Integer) - (Integer)) - (Identifier)))))) + (Array + (Integer) + (Identifier))))) + ( + (Annotation + (Identifier) + (Array + (Integer) + (Array + (Integer) + (Array + (Integer) + (Identifier))))))))) diff --git a/test/fixtures/go/array-types.parseB.txt b/test/fixtures/go/array-types.parseB.txt index f9653b483..02dbfdd8b 100644 --- a/test/fixtures/go/array-types.parseB.txt +++ b/test/fixtures/go/array-types.parseB.txt @@ -5,10 +5,29 @@ (Empty) (Identifier) ( - (Annotation - (Identifier) - (Array - (Plus + ( + (Annotation + (Identifier) + (Array + (Plus + (Integer) + (Integer)) + (Identifier)))) + ( + (Annotation + (Identifier) + (Array (Integer) - (Integer)) - (Identifier)))))) + (Array + (Integer) + (Identifier))))) + ( + (Annotation + (Identifier) + (Array + (Integer) + (Array + (Integer) + (Array + (Integer) + (Identifier))))))))) From ea924e8801e909879141af08123e764dfad3837b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:55:28 -0800 Subject: [PATCH 150/176] :fire: handleError from channel type assignment --- src/Language/Go/Assignment.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 0c5537835..f26c6d01c 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -269,8 +269,7 @@ sliceType :: Assignment sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression) channelType :: Assignment -channelType = handleError - $ (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) +channelType = (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression)))) <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> (Type.BiDirectionalChannel <$> expression)))) From c883c9926e2c0ef3dff8966c07f7d7db8549343e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 16:57:03 -0800 Subject: [PATCH 151/176] Add additional channel type tests --- test/fixtures/go/channel-types.A.go | 2 ++ test/fixtures/go/channel-types.B.go | 2 ++ test/fixtures/go/channel-types.diffA-B.txt | 39 ++++++++++++++++++---- test/fixtures/go/channel-types.diffB-A.txt | 39 ++++++++++++++++++---- test/fixtures/go/channel-types.parseA.txt | 13 +++++++- test/fixtures/go/channel-types.parseB.txt | 13 +++++++- 6 files changed, 92 insertions(+), 16 deletions(-) diff --git a/test/fixtures/go/channel-types.A.go b/test/fixtures/go/channel-types.A.go index 1c10bf6f7..f3c1f8613 100644 --- a/test/fixtures/go/channel-types.A.go +++ b/test/fixtures/go/channel-types.A.go @@ -5,5 +5,7 @@ type ( c1 chan<- chan int c2 chan<- chan<- struct{} c3 chan<- <-chan int +c4 <-chan <-chan int +c5 chan (<-chan int) ) } diff --git a/test/fixtures/go/channel-types.B.go b/test/fixtures/go/channel-types.B.go index 196a7928e..792fa7229 100644 --- a/test/fixtures/go/channel-types.B.go +++ b/test/fixtures/go/channel-types.B.go @@ -5,5 +5,7 @@ type ( c2 chan<- chan string c3 chan<- chan<- struct{} c4 chan<- <-chan string +c4 <-chan <-chan string +c5 chan (<-chan string) ) } diff --git a/test/fixtures/go/channel-types.diffA-B.txt b/test/fixtures/go/channel-types.diffA-B.txt index 24bc03596..7e3332ab9 100644 --- a/test/fixtures/go/channel-types.diffA-B.txt +++ b/test/fixtures/go/channel-types.diffA-B.txt @@ -19,10 +19,35 @@ (BiDirectionalChannel (Constructor (Empty))))) - (Annotation - { (Identifier) - ->(Identifier) } - (SendChannel - (ReceiveChannel - { (Identifier) - ->(Identifier) })))))) + {+(Annotation + {+(Identifier)+} + {+(SendChannel + {+(ReceiveChannel + {+(Identifier)+})+})+})+} + {+(Annotation + {+(Identifier)+} + {+(ReceiveChannel + {+(ReceiveChannel + {+(Identifier)+})+})+})+} + {+(Annotation + {+(Identifier)+} + {+(BiDirectionalChannel + {+(ParenthesizedType + {+(ReceiveChannel + {+(Identifier)+})+})+})+})+} + {-(Annotation + {-(Identifier)-} + {-(SendChannel + {-(ReceiveChannel + {-(Identifier)-})-})-})-} + {-(Annotation + {-(Identifier)-} + {-(ReceiveChannel + {-(ReceiveChannel + {-(Identifier)-})-})-})-} + {-(Annotation + {-(Identifier)-} + {-(BiDirectionalChannel + {-(ParenthesizedType + {-(ReceiveChannel + {-(Identifier)-})-})-})-})-}))) diff --git a/test/fixtures/go/channel-types.diffB-A.txt b/test/fixtures/go/channel-types.diffB-A.txt index 24bc03596..7e3332ab9 100644 --- a/test/fixtures/go/channel-types.diffB-A.txt +++ b/test/fixtures/go/channel-types.diffB-A.txt @@ -19,10 +19,35 @@ (BiDirectionalChannel (Constructor (Empty))))) - (Annotation - { (Identifier) - ->(Identifier) } - (SendChannel - (ReceiveChannel - { (Identifier) - ->(Identifier) })))))) + {+(Annotation + {+(Identifier)+} + {+(SendChannel + {+(ReceiveChannel + {+(Identifier)+})+})+})+} + {+(Annotation + {+(Identifier)+} + {+(ReceiveChannel + {+(ReceiveChannel + {+(Identifier)+})+})+})+} + {+(Annotation + {+(Identifier)+} + {+(BiDirectionalChannel + {+(ParenthesizedType + {+(ReceiveChannel + {+(Identifier)+})+})+})+})+} + {-(Annotation + {-(Identifier)-} + {-(SendChannel + {-(ReceiveChannel + {-(Identifier)-})-})-})-} + {-(Annotation + {-(Identifier)-} + {-(ReceiveChannel + {-(ReceiveChannel + {-(Identifier)-})-})-})-} + {-(Annotation + {-(Identifier)-} + {-(BiDirectionalChannel + {-(ParenthesizedType + {-(ReceiveChannel + {-(Identifier)-})-})-})-})-}))) diff --git a/test/fixtures/go/channel-types.parseA.txt b/test/fixtures/go/channel-types.parseA.txt index 0e7f4d5e7..5500eed2c 100644 --- a/test/fixtures/go/channel-types.parseA.txt +++ b/test/fixtures/go/channel-types.parseA.txt @@ -20,4 +20,15 @@ (Identifier) (SendChannel (ReceiveChannel - (Identifier))))))) + (Identifier)))) + (Annotation + (Identifier) + (ReceiveChannel + (ReceiveChannel + (Identifier)))) + (Annotation + (Identifier) + (BiDirectionalChannel + (ParenthesizedType + (ReceiveChannel + (Identifier)))))))) diff --git a/test/fixtures/go/channel-types.parseB.txt b/test/fixtures/go/channel-types.parseB.txt index 0e7f4d5e7..5500eed2c 100644 --- a/test/fixtures/go/channel-types.parseB.txt +++ b/test/fixtures/go/channel-types.parseB.txt @@ -20,4 +20,15 @@ (Identifier) (SendChannel (ReceiveChannel - (Identifier))))))) + (Identifier)))) + (Annotation + (Identifier) + (ReceiveChannel + (ReceiveChannel + (Identifier)))) + (Annotation + (Identifier) + (BiDirectionalChannel + (ParenthesizedType + (ReceiveChannel + (Identifier)))))))) From acdb026393ccad2d061e46afe593cb674a11b8bd Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 7 Nov 2017 17:05:37 -0800 Subject: [PATCH 152/176] Add additional assignment statement test cases --- test/fixtures/go/assignment-statements.A.go | 7 + test/fixtures/go/assignment-statements.B.go | 15 +- .../go/assignment-statements.diffA-B.txt | 141 ++++++++++++++---- .../go/assignment-statements.diffB-A.txt | 135 +++++++++++++---- .../go/assignment-statements.parseA.txt | 31 ++++ .../go/assignment-statements.parseB.txt | 31 ++++ 6 files changed, 296 insertions(+), 64 deletions(-) diff --git a/test/fixtures/go/assignment-statements.A.go b/test/fixtures/go/assignment-statements.A.go index 9633bfa9e..d667f0a08 100644 --- a/test/fixtures/go/assignment-statements.A.go +++ b/test/fixtures/go/assignment-statements.A.go @@ -5,5 +5,12 @@ a = 1 b, c += 2, 3 d *= 3 e += 1 +f <<= 1 +g >>= 2 +h /= 2 +i ^= 2 +j %= 2 +k &^= 2 + var pointer *Point3D = &Point3D{y: 1000} } diff --git a/test/fixtures/go/assignment-statements.B.go b/test/fixtures/go/assignment-statements.B.go index 3945d0dce..7fb9d8e47 100644 --- a/test/fixtures/go/assignment-statements.B.go +++ b/test/fixtures/go/assignment-statements.B.go @@ -1,9 +1,16 @@ package main func main() { -x = 1 -y, c += 2, 3 -z *= 3 -h += 1 +h = 1 +f, g += 2, 3 +e *= 3 +d += 1 +c <<= 1 +b >>= 2 +a /= 2 +z ^= 2 +y %= 2 +x &^= 2 + var pointer *Point2D = &Point2D{x: 1000} } diff --git a/test/fixtures/go/assignment-statements.diffA-B.txt b/test/fixtures/go/assignment-statements.diffA-B.txt index 32e932195..93b76a5d0 100644 --- a/test/fixtures/go/assignment-statements.diffA-B.txt +++ b/test/fixtures/go/assignment-statements.diffA-B.txt @@ -13,41 +13,120 @@ ( { (Identifier) ->(Identifier) } - (Identifier)) + { (Identifier) + ->(Identifier) }) (Plus ( { (Identifier) ->(Identifier) } - (Identifier)) + { (Identifier) + ->(Identifier) }) ( (Integer) (Integer)))) - (Assignment - { (Identifier) - ->(Identifier) } - (Times - { (Identifier) - ->(Identifier) } - (Integer))) - (Assignment - { (Identifier) - ->(Identifier) } - (Plus - { (Identifier) - ->(Identifier) } - (Integer))) - (Assignment - (Identifier) - ( - (Pointer - { (Identifier) - ->(Identifier) }) - (Reference - (Composite - { (Identifier) - ->(Identifier) } - ( - (KeyValue - { (Identifier) - ->(Identifier) } - (Integer)))))))))) + {+(Assignment + {+(Identifier)+} + {+(Times + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Plus + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(LShift + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(RShift + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(DividedBy + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(BXOr + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Modulo + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Not + {+(BAnd + {+(Identifier)+} + {+(Integer)+})+})+})+} + {+(Assignment + {+(Identifier)+} + {+( + {+(Pointer + {+(Identifier)+})+} + {+(Reference + {+(Composite + {+(Identifier)+} + {+( + {+(KeyValue + {+(Identifier)+} + {+(Integer)+})+})+})+})+})+})+} + {-(Assignment + {-(Identifier)-} + {-(Times + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Plus + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(LShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(RShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(DividedBy + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(BXOr + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Modulo + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Not + {-(BAnd + {-(Identifier)-} + {-(Integer)-})-})-})-} + {-(Assignment + {-(Identifier)-} + {-( + {-(Pointer + {-(Identifier)-})-} + {-(Reference + {-(Composite + {-(Identifier)-} + {-( + {-(KeyValue + {-(Identifier)-} + {-(Integer)-})-})-})-})-})-})-}))) diff --git a/test/fixtures/go/assignment-statements.diffB-A.txt b/test/fixtures/go/assignment-statements.diffB-A.txt index 32e932195..6258eae0e 100644 --- a/test/fixtures/go/assignment-statements.diffB-A.txt +++ b/test/fixtures/go/assignment-statements.diffB-A.txt @@ -13,41 +13,118 @@ ( { (Identifier) ->(Identifier) } - (Identifier)) + { (Identifier) + ->(Identifier) }) (Plus ( { (Identifier) ->(Identifier) } - (Identifier)) + { (Identifier) + ->(Identifier) }) ( (Integer) (Integer)))) - (Assignment - { (Identifier) - ->(Identifier) } - (Times - { (Identifier) - ->(Identifier) } - (Integer))) - (Assignment - { (Identifier) - ->(Identifier) } - (Plus - { (Identifier) - ->(Identifier) } - (Integer))) + {+(Assignment + {+(Identifier)+} + {+(Times + {+(Identifier)+} + {+(Integer)+})+})+} (Assignment (Identifier) - ( - (Pointer - { (Identifier) - ->(Identifier) }) - (Reference - (Composite - { (Identifier) - ->(Identifier) } - ( - (KeyValue - { (Identifier) - ->(Identifier) } - (Integer)))))))))) + { (Times + {-(Identifier)-} + {-(Integer)-}) + ->(Plus + {+(Identifier)+} + {+(Integer)+}) }) + {+(Assignment + {+(Identifier)+} + {+(LShift + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(RShift + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(DividedBy + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(BXOr + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Modulo + {+(Identifier)+} + {+(Integer)+})+})+} + {+(Assignment + {+(Identifier)+} + {+(Not + {+(BAnd + {+(Identifier)+} + {+(Integer)+})+})+})+} + {+(Assignment + {+(Identifier)+} + {+( + {+(Pointer + {+(Identifier)+})+} + {+(Reference + {+(Composite + {+(Identifier)+} + {+( + {+(KeyValue + {+(Identifier)+} + {+(Integer)+})+})+})+})+})+})+} + {-(Assignment + {-(Identifier)-} + {-(Plus + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(LShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(RShift + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(DividedBy + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(BXOr + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Modulo + {-(Identifier)-} + {-(Integer)-})-})-} + {-(Assignment + {-(Identifier)-} + {-(Not + {-(BAnd + {-(Identifier)-} + {-(Integer)-})-})-})-} + {-(Assignment + {-(Identifier)-} + {-( + {-(Pointer + {-(Identifier)-})-} + {-(Reference + {-(Composite + {-(Identifier)-} + {-( + {-(KeyValue + {-(Identifier)-} + {-(Integer)-})-})-})-})-})-})-}))) diff --git a/test/fixtures/go/assignment-statements.parseA.txt b/test/fixtures/go/assignment-statements.parseA.txt index fb76569f5..b495fabbf 100644 --- a/test/fixtures/go/assignment-statements.parseA.txt +++ b/test/fixtures/go/assignment-statements.parseA.txt @@ -29,6 +29,37 @@ (Plus (Identifier) (Integer))) + (Assignment + (Identifier) + (LShift + (Identifier) + (Integer))) + (Assignment + (Identifier) + (RShift + (Identifier) + (Integer))) + (Assignment + (Identifier) + (DividedBy + (Identifier) + (Integer))) + (Assignment + (Identifier) + (BXOr + (Identifier) + (Integer))) + (Assignment + (Identifier) + (Modulo + (Identifier) + (Integer))) + (Assignment + (Identifier) + (Not + (BAnd + (Identifier) + (Integer)))) (Assignment (Identifier) ( diff --git a/test/fixtures/go/assignment-statements.parseB.txt b/test/fixtures/go/assignment-statements.parseB.txt index fb76569f5..b495fabbf 100644 --- a/test/fixtures/go/assignment-statements.parseB.txt +++ b/test/fixtures/go/assignment-statements.parseB.txt @@ -29,6 +29,37 @@ (Plus (Identifier) (Integer))) + (Assignment + (Identifier) + (LShift + (Identifier) + (Integer))) + (Assignment + (Identifier) + (RShift + (Identifier) + (Integer))) + (Assignment + (Identifier) + (DividedBy + (Identifier) + (Integer))) + (Assignment + (Identifier) + (BXOr + (Identifier) + (Integer))) + (Assignment + (Identifier) + (Modulo + (Identifier) + (Integer))) + (Assignment + (Identifier) + (Not + (BAnd + (Identifier) + (Integer)))) (Assignment (Identifier) ( From 4af7f45d62ded16e57b88cffbc6e44b0d8aee5b0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 8 Nov 2017 11:03:33 -0800 Subject: [PATCH 153/176] Bump haskell-tree-sitter --- vendor/haskell-tree-sitter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/haskell-tree-sitter b/vendor/haskell-tree-sitter index 507ff7915..e47c5673f 160000 --- a/vendor/haskell-tree-sitter +++ b/vendor/haskell-tree-sitter @@ -1 +1 @@ -Subproject commit 507ff79150f5f26b74687a7900c681b22b80ba48 +Subproject commit e47c5673ff45a025a2338bbdbae8e724a5780d0c From e7921e1c1c0c13d7a984027054db3e307b48d19a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 8 Nov 2017 11:13:11 -0800 Subject: [PATCH 154/176] Regenerate tests --- test/fixtures/go/array-types.diffA-B.txt | 14 ----- test/fixtures/go/array-types.diffB-A.txt | 14 ----- test/fixtures/go/array-types.parseA.txt | 13 ----- test/fixtures/go/array-types.parseB.txt | 13 ----- test/fixtures/go/call-expressions.diffA-B.txt | 21 -------- test/fixtures/go/call-expressions.diffB-A.txt | 21 -------- test/fixtures/go/call-expressions.parseA.txt | 18 ------- test/fixtures/go/call-expressions.parseB.txt | 18 ------- test/fixtures/go/constructors.diffA-B.txt | 21 -------- test/fixtures/go/constructors.diffB-A.txt | 21 -------- test/fixtures/go/constructors.parseA.txt | 14 ----- test/fixtures/go/constructors.parseB.txt | 14 ----- test/fixtures/go/for-statements.diffA-B.txt | 41 --------------- test/fixtures/go/for-statements.diffB-A.txt | 50 ------------------ test/fixtures/go/for-statements.parseA.txt | 29 ----------- test/fixtures/go/for-statements.parseB.txt | 12 ----- test/fixtures/go/if-statements.diffA-B.txt | 35 ------------- test/fixtures/go/if-statements.diffB-A.txt | 35 ------------- test/fixtures/go/if-statements.parseA.txt | 32 ------------ test/fixtures/go/if-statements.parseB.txt | 32 ------------ .../fixtures/go/select-statements.diffA-B.txt | 31 ----------- .../fixtures/go/select-statements.diffB-A.txt | 31 ----------- test/fixtures/go/select-statements.parseA.txt | 28 ---------- test/fixtures/go/select-statements.parseB.txt | 28 ---------- .../fixtures/go/switch-statements.diffA-B.txt | 47 ----------------- .../fixtures/go/switch-statements.diffB-A.txt | 52 ------------------- test/fixtures/go/switch-statements.parseA.txt | 32 ------------ test/fixtures/go/switch-statements.parseB.txt | 32 ------------ ...variadic-function-declarations.diffA-B.txt | 19 ------- ...variadic-function-declarations.diffB-A.txt | 19 ------- .../variadic-function-declarations.parseA.txt | 19 ------- .../variadic-function-declarations.parseB.txt | 19 ------- 32 files changed, 825 deletions(-) diff --git a/test/fixtures/go/array-types.diffA-B.txt b/test/fixtures/go/array-types.diffA-B.txt index 775f5dc06..1bdf4a4f8 100644 --- a/test/fixtures/go/array-types.diffA-B.txt +++ b/test/fixtures/go/array-types.diffA-B.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( ( (Annotation @@ -19,19 +18,6 @@ ->(Identifier) }))) ( (Annotation -======= - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (ArrayTy - (RelationalOperator - { (NumberLiteral) - ->(NumberLiteral) } - (Other "+") - { (NumberLiteral) - ->(NumberLiteral) }) ->>>>>>> master { (Identifier) ->(Identifier) } (Array diff --git a/test/fixtures/go/array-types.diffB-A.txt b/test/fixtures/go/array-types.diffB-A.txt index 775f5dc06..1bdf4a4f8 100644 --- a/test/fixtures/go/array-types.diffB-A.txt +++ b/test/fixtures/go/array-types.diffB-A.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( ( (Annotation @@ -19,19 +18,6 @@ ->(Identifier) }))) ( (Annotation -======= - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (ArrayTy - (RelationalOperator - { (NumberLiteral) - ->(NumberLiteral) } - (Other "+") - { (NumberLiteral) - ->(NumberLiteral) }) ->>>>>>> master { (Identifier) ->(Identifier) } (Array diff --git a/test/fixtures/go/array-types.parseA.txt b/test/fixtures/go/array-types.parseA.txt index eae0cfa0b..02dbfdd8b 100644 --- a/test/fixtures/go/array-types.parseA.txt +++ b/test/fixtures/go/array-types.parseA.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( ( (Annotation @@ -32,15 +31,3 @@ (Array (Integer) (Identifier))))))))) -======= - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (ArrayTy - (RelationalOperator - (NumberLiteral) - (Other "+") - (NumberLiteral)) - (Identifier)))))) ->>>>>>> master diff --git a/test/fixtures/go/array-types.parseB.txt b/test/fixtures/go/array-types.parseB.txt index eae0cfa0b..02dbfdd8b 100644 --- a/test/fixtures/go/array-types.parseB.txt +++ b/test/fixtures/go/array-types.parseB.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( ( (Annotation @@ -32,15 +31,3 @@ (Array (Integer) (Identifier))))))))) -======= - (Args) - (Other "type_declaration" - (TypeDecl - (Identifier) - (ArrayTy - (RelationalOperator - (NumberLiteral) - (Other "+") - (NumberLiteral)) - (Identifier)))))) ->>>>>>> master diff --git a/test/fixtures/go/call-expressions.diffA-B.txt b/test/fixtures/go/call-expressions.diffA-B.txt index caf6842f9..16d749ec1 100644 --- a/test/fixtures/go/call-expressions.diffA-B.txt +++ b/test/fixtures/go/call-expressions.diffA-B.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (Call { (Identifier) @@ -26,23 +25,3 @@ (Variadic (Identifier)) (Empty))))) -======= - (Args) - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "variadic_argument" - (Identifier))) - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Identifier)) - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "variadic_argument" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/call-expressions.diffB-A.txt b/test/fixtures/go/call-expressions.diffB-A.txt index caf6842f9..16d749ec1 100644 --- a/test/fixtures/go/call-expressions.diffB-A.txt +++ b/test/fixtures/go/call-expressions.diffB-A.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (Call { (Identifier) @@ -26,23 +25,3 @@ (Variadic (Identifier)) (Empty))))) -======= - (Args) - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "variadic_argument" - (Identifier))) - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Identifier)) - (FunctionCall - { (Identifier) - ->(Identifier) } - (Identifier) - (Other "variadic_argument" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/call-expressions.parseA.txt b/test/fixtures/go/call-expressions.parseA.txt index e525ec672..ec555cda4 100644 --- a/test/fixtures/go/call-expressions.parseA.txt +++ b/test/fixtures/go/call-expressions.parseA.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (Call (Identifier) @@ -23,20 +22,3 @@ (Variadic (Identifier)) (Empty))))) -======= - (Args) - (FunctionCall - (Identifier) - (Identifier) - (Other "variadic_argument" - (Identifier))) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)) - (FunctionCall - (Identifier) - (Identifier) - (Other "variadic_argument" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/call-expressions.parseB.txt b/test/fixtures/go/call-expressions.parseB.txt index e525ec672..ec555cda4 100644 --- a/test/fixtures/go/call-expressions.parseB.txt +++ b/test/fixtures/go/call-expressions.parseB.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (Call (Identifier) @@ -23,20 +22,3 @@ (Variadic (Identifier)) (Empty))))) -======= - (Args) - (FunctionCall - (Identifier) - (Identifier) - (Other "variadic_argument" - (Identifier))) - (FunctionCall - (Identifier) - (Identifier) - (Identifier)) - (FunctionCall - (Identifier) - (Identifier) - (Other "variadic_argument" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/constructors.diffA-B.txt b/test/fixtures/go/constructors.diffA-B.txt index 2d6a052bd..0a653c743 100644 --- a/test/fixtures/go/constructors.diffA-B.txt +++ b/test/fixtures/go/constructors.diffA-B.txt @@ -7,7 +7,6 @@ ( (Call (Identifier) -<<<<<<< HEAD (BiDirectionalChannel { (Identifier) ->(Identifier) }) @@ -39,23 +38,3 @@ { (Identifier) ->(Identifier) }) (Empty))))) -======= - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) }) - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) }) - (FunctionCall - (Identifier) - (DictionaryTy - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) ->>>>>>> master diff --git a/test/fixtures/go/constructors.diffB-A.txt b/test/fixtures/go/constructors.diffB-A.txt index 2d6a052bd..0a653c743 100644 --- a/test/fixtures/go/constructors.diffB-A.txt +++ b/test/fixtures/go/constructors.diffB-A.txt @@ -7,7 +7,6 @@ ( (Call (Identifier) -<<<<<<< HEAD (BiDirectionalChannel { (Identifier) ->(Identifier) }) @@ -39,23 +38,3 @@ { (Identifier) ->(Identifier) }) (Empty))))) -======= - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - { (Identifier) - ->(Identifier) }) - { (NumberLiteral) - ->(NumberLiteral) } - { (NumberLiteral) - ->(NumberLiteral) }) - (FunctionCall - (Identifier) - (DictionaryTy - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) })))) ->>>>>>> master diff --git a/test/fixtures/go/constructors.parseA.txt b/test/fixtures/go/constructors.parseA.txt index eb586ca37..53e03f22b 100644 --- a/test/fixtures/go/constructors.parseA.txt +++ b/test/fixtures/go/constructors.parseA.txt @@ -7,24 +7,10 @@ ( (Call (Identifier) -<<<<<<< HEAD (BiDirectionalChannel (Identifier)) (Empty)) (Call -======= - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier)) - (NumberLiteral) - (NumberLiteral)) - (FunctionCall - (Identifier) - (DictionaryTy ->>>>>>> master (Identifier) (BiDirectionalChannel (Identifier)) diff --git a/test/fixtures/go/constructors.parseB.txt b/test/fixtures/go/constructors.parseB.txt index eb586ca37..53e03f22b 100644 --- a/test/fixtures/go/constructors.parseB.txt +++ b/test/fixtures/go/constructors.parseB.txt @@ -7,24 +7,10 @@ ( (Call (Identifier) -<<<<<<< HEAD (BiDirectionalChannel (Identifier)) (Empty)) (Call -======= - (Other "-") - (Identifier))) - (FunctionCall - (Identifier) - (ChannelTy - (Identifier)) - (NumberLiteral) - (NumberLiteral)) - (FunctionCall - (Identifier) - (DictionaryTy ->>>>>>> master (Identifier) (BiDirectionalChannel (Identifier)) diff --git a/test/fixtures/go/for-statements.diffA-B.txt b/test/fixtures/go/for-statements.diffA-B.txt index 5eed6fded..5be234393 100644 --- a/test/fixtures/go/for-statements.diffA-B.txt +++ b/test/fixtures/go/for-statements.diffA-B.txt @@ -18,7 +18,6 @@ {+(ForEach {+(Identifier)+} {+(Identifier)+} -<<<<<<< HEAD {+( {+(Call {+(Identifier)+} @@ -81,17 +80,6 @@ {+(Empty)+})+})+} {+(ForEach {+( -======= - {+(Other "<")+} - {+(NumberLiteral)+})+} - {+(IncrementStatement)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue)+})+} - {+(For - {+(ExpressionStatements - {+(FunctionCall ->>>>>>> master {+(Identifier)+} {+(Identifier)+})+} {+(Identifier)+} @@ -129,7 +117,6 @@ {-(Empty)-})-})-})-} {-(ForEach {-(Identifier)-} -<<<<<<< HEAD {-(Identifier)-} {-( {-(Call @@ -160,33 +147,5 @@ {-(Empty)-})-})-} {-(ForEach {-(Empty)-} -======= - {-(Other "<")-} - {-(NumberLiteral)-})-} - {-(IncrementStatement)-} - {-(FunctionCall - {-(Identifier)-})-} - {-(Break - {-(Identifier)-})-})-} - {-(For - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(NumberLiteral)-})-} - {-(IncrementStatement)-} - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue - {-(Identifier)-})-})-} - {-(For - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue)-})-} - {-(For - {-(Other "expression_list" - {-(Identifier)-})-} - {-(Identifier)-} - {-(FunctionCall ->>>>>>> master {-(Identifier)-} {-([])-})-}))) diff --git a/test/fixtures/go/for-statements.diffB-A.txt b/test/fixtures/go/for-statements.diffB-A.txt index f949ff60b..6f4b2c152 100644 --- a/test/fixtures/go/for-statements.diffB-A.txt +++ b/test/fixtures/go/for-statements.diffB-A.txt @@ -69,7 +69,6 @@ {+(Identifier)+} {+(Identifier)+})+} {+(Identifier)+} -<<<<<<< HEAD {+(Call {+(Identifier)+} {+(Identifier)+} @@ -135,55 +134,6 @@ {-(Empty)-})-})-} {-(ForEach {-( -======= - {+(Other "<")+} - {+(NumberLiteral)+})+} - {+(IncrementStatement)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Break - {+(Identifier)+})+})+} - {+(For - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(NumberLiteral)+})+} - {+(IncrementStatement)+} - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue - {+(Identifier)+})+})+} - {+(For - {+(FunctionCall - {+(Identifier)+})+} - {+(Continue)+})+} - (For - (Other "expression_list" - (Identifier)) - (Identifier) - (FunctionCall - (Identifier) - {+(Identifier)+}) - (Break - {-(Identifier)-})) - {-(For - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue - {-(Identifier)-})-})-} - {-(For - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(NumberLiteral)-})-} - {-(IncrementStatement)-} - {-(FunctionCall - {-(Identifier)-})-} - {-(Continue)-})-} - {-(For - {-(ExpressionStatements - {-(FunctionCall ->>>>>>> master {-(Identifier)-} {-(Identifier)-})-} {-(Identifier)-} diff --git a/test/fixtures/go/for-statements.parseA.txt b/test/fixtures/go/for-statements.parseA.txt index 0be9298a7..e80cd9800 100644 --- a/test/fixtures/go/for-statements.parseA.txt +++ b/test/fixtures/go/for-statements.parseA.txt @@ -55,7 +55,6 @@ (Empty)))) (ForEach (Identifier) -<<<<<<< HEAD (Identifier) ( (Call @@ -86,33 +85,5 @@ (Empty))) (ForEach (Empty) -======= - (Other "<") - (NumberLiteral)) - (IncrementStatement) - (FunctionCall - (Identifier)) - (Break - (Identifier))) - (For - (RelationalOperator - (Identifier) - (Other "<") - (NumberLiteral)) - (IncrementStatement) - (FunctionCall - (Identifier)) - (Continue - (Identifier))) - (For - (FunctionCall - (Identifier)) - (Continue)) - (For - (Other "expression_list" - (Identifier)) - (Identifier) - (FunctionCall ->>>>>>> master (Identifier) ([]))))) diff --git a/test/fixtures/go/for-statements.parseB.txt b/test/fixtures/go/for-statements.parseB.txt index 47f1096a4..a52cd0cee 100644 --- a/test/fixtures/go/for-statements.parseB.txt +++ b/test/fixtures/go/for-statements.parseB.txt @@ -17,7 +17,6 @@ (Identifier)))) (ForEach (Identifier) -<<<<<<< HEAD (Identifier) ( (Call @@ -71,17 +70,6 @@ (Empty))) (ForEach ( -======= - (Other "<") - (NumberLiteral)) - (IncrementStatement) - (FunctionCall - (Identifier)) - (Continue)) - (For - (ExpressionStatements - (FunctionCall ->>>>>>> master (Identifier) (Identifier)) (Identifier) diff --git a/test/fixtures/go/if-statements.diffA-B.txt b/test/fixtures/go/if-statements.diffA-B.txt index 803a44e30..56c2a1b75 100644 --- a/test/fixtures/go/if-statements.diffA-B.txt +++ b/test/fixtures/go/if-statements.diffA-B.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (If ( @@ -68,37 +67,3 @@ { (Identifier) ->(Identifier) } (Empty))))))) -======= - (Args) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))))) ->>>>>>> master diff --git a/test/fixtures/go/if-statements.diffB-A.txt b/test/fixtures/go/if-statements.diffB-A.txt index 803a44e30..56c2a1b75 100644 --- a/test/fixtures/go/if-statements.diffB-A.txt +++ b/test/fixtures/go/if-statements.diffB-A.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (If ( @@ -68,37 +67,3 @@ { (Identifier) ->(Identifier) } (Empty))))))) -======= - (Args) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - { (Identifier) - ->(Identifier) }) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - { (Identifier) - ->(Identifier) }) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))))) ->>>>>>> master diff --git a/test/fixtures/go/if-statements.parseA.txt b/test/fixtures/go/if-statements.parseA.txt index cf69912fc..5c54cbfcc 100644 --- a/test/fixtures/go/if-statements.parseA.txt +++ b/test/fixtures/go/if-statements.parseA.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (If ( @@ -60,34 +59,3 @@ (Call (Identifier) (Empty))))))) -======= - (Args) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))))) ->>>>>>> master diff --git a/test/fixtures/go/if-statements.parseB.txt b/test/fixtures/go/if-statements.parseB.txt index cf69912fc..5c54cbfcc 100644 --- a/test/fixtures/go/if-statements.parseB.txt +++ b/test/fixtures/go/if-statements.parseB.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD ( (If ( @@ -60,34 +59,3 @@ (Call (Identifier) (Empty))))))) -======= - (Args) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (Other "if_initializer" - (VarDecl - (Other "expression_list" - (Identifier)) - (Other "expression_list" - (FunctionCall - (Identifier))))) - (Identifier) - (ExpressionStatements - (FunctionCall - (Identifier)))) - (If - (FunctionCall - (Identifier)) - (ExpressionStatements - (FunctionCall - (Identifier))) - (Other "else_clause" - (ExpressionStatements - (FunctionCall - (Identifier))))))) ->>>>>>> master diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 53dabb9ca..821631b38 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -9,7 +9,6 @@ (Pattern (Receive { (Identifier) -<<<<<<< HEAD ->(Identifier) } (Receive (Empty) @@ -48,33 +47,3 @@ ([])) (Return (Empty))))))) -======= - ->(Identifier) }) - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - { (Identifier) - ->(Identifier) } - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - { (NumberLiteral) - ->(NumberLiteral) })))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Other "default_communication_case") - (Return)))) ->>>>>>> master diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 53dabb9ca..821631b38 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -9,7 +9,6 @@ (Pattern (Receive { (Identifier) -<<<<<<< HEAD ->(Identifier) } (Receive (Empty) @@ -48,33 +47,3 @@ ([])) (Return (Empty))))))) -======= - ->(Identifier) }) - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - { (Identifier) - ->(Identifier) } - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - { (NumberLiteral) - ->(NumberLiteral) })))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Other "default_communication_case") - (Return)))) ->>>>>>> master diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index d8d9f2321..e11b4060b 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -20,7 +20,6 @@ (Send (Identifier) (Identifier)) -<<<<<<< HEAD (Call (Identifier) (Integer) @@ -45,30 +44,3 @@ ([])) (Return (Empty))))))) -======= - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - (Identifier) - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (NumberLiteral))))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Other "default_communication_case") - (Return)))) ->>>>>>> master diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index d8d9f2321..e11b4060b 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -20,7 +20,6 @@ (Send (Identifier) (Identifier)) -<<<<<<< HEAD (Call (Identifier) (Integer) @@ -45,30 +44,3 @@ ([])) (Return (Empty))))))) -======= - (Operator - (Identifier)))) - (FunctionCall - (Identifier) - (Identifier)) - (Case - (Send - (Identifier) - (Identifier))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Case - (Other "receive_statement" - (Operator - (FunctionCall - (SubscriptAccess - (Identifier) - (Identifier)) - (NumberLiteral))))) - (FunctionCall - (Identifier) - (NumberLiteral)) - (Other "default_communication_case") - (Return)))) ->>>>>>> master diff --git a/test/fixtures/go/switch-statements.diffA-B.txt b/test/fixtures/go/switch-statements.diffA-B.txt index f3de1e59f..ba6d7b831 100644 --- a/test/fixtures/go/switch-statements.diffA-B.txt +++ b/test/fixtures/go/switch-statements.diffA-B.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD (Match (Pattern (LessThan @@ -34,49 +33,3 @@ { (Identifier) ->(Identifier) } (Empty))))))) -======= - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - { (Identifier) - ->(Identifier) } - (Other "<") - { (Identifier) - ->(Identifier) }))) - (FunctionCall - (Identifier))) - {+(Case - {+(Case - {+(Other "expression_list" - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(Identifier)+})+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+} - (Case - (Case - (Other "expression_list" - (RelationalOperator - { (Identifier) - ->(Identifier) } - { (Other "<") - ->(Other "==") } - { (Identifier) - ->(NumberLiteral) }))) - (FunctionCall - { (Identifier) - ->(Identifier) })) - {-(Case - {-(Case - {-(Other "expression_list" - {-(RelationalOperator - {-(Identifier)-} - {-(Other "==")-} - {-(NumberLiteral)-})-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-}))) ->>>>>>> master diff --git a/test/fixtures/go/switch-statements.diffB-A.txt b/test/fixtures/go/switch-statements.diffB-A.txt index f05e35bda..ba6d7b831 100644 --- a/test/fixtures/go/switch-statements.diffB-A.txt +++ b/test/fixtures/go/switch-statements.diffB-A.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD (Match (Pattern (LessThan @@ -34,54 +33,3 @@ { (Identifier) ->(Identifier) } (Empty))))))) -======= - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - { (Identifier) - ->(Identifier) } - (Other "<") - { (Identifier) - ->(Identifier) }))) - (FunctionCall - (Identifier))) - {+(Case - {+(Case - {+(Other "expression_list" - {+(RelationalOperator - {+(Identifier)+} - {+(Other "<")+} - {+(Identifier)+})+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+} - {+(Case - {+(Case - {+(Other "expression_list" - {+(RelationalOperator - {+(Identifier)+} - {+(Other "==")+} - {+(NumberLiteral)+})+})+})+} - {+(FunctionCall - {+(Identifier)+})+})+} - {-(Case - {-(Case - {-(Other "expression_list" - {-(RelationalOperator - {-(Identifier)-} - {-(Other "<")-} - {-(Identifier)-})-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-} - {-(Case - {-(Case - {-(Other "expression_list" - {-(RelationalOperator - {-(Identifier)-} - {-(Other "==")-} - {-(NumberLiteral)-})-})-})-} - {-(FunctionCall - {-(Identifier)-})-})-}))) ->>>>>>> master diff --git a/test/fixtures/go/switch-statements.parseA.txt b/test/fixtures/go/switch-statements.parseA.txt index 9692eaf0b..c8e2b46c1 100644 --- a/test/fixtures/go/switch-statements.parseA.txt +++ b/test/fixtures/go/switch-statements.parseA.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD (Match (Pattern (LessThan @@ -28,34 +27,3 @@ (Call (Identifier) (Empty))))))) -======= - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "==") - (NumberLiteral)))) - (FunctionCall - (Identifier)))))) ->>>>>>> master diff --git a/test/fixtures/go/switch-statements.parseB.txt b/test/fixtures/go/switch-statements.parseB.txt index 9692eaf0b..c8e2b46c1 100644 --- a/test/fixtures/go/switch-statements.parseB.txt +++ b/test/fixtures/go/switch-statements.parseB.txt @@ -4,7 +4,6 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD (Match (Pattern (LessThan @@ -28,34 +27,3 @@ (Call (Identifier) (Empty))))))) -======= - (Args) - (Switch - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "<") - (Identifier)))) - (FunctionCall - (Identifier))) - (Case - (Case - (Other "expression_list" - (RelationalOperator - (Identifier) - (Other "==") - (NumberLiteral)))) - (FunctionCall - (Identifier)))))) ->>>>>>> master diff --git a/test/fixtures/go/variadic-function-declarations.diffA-B.txt b/test/fixtures/go/variadic-function-declarations.diffA-B.txt index 1bc5da033..89196f558 100644 --- a/test/fixtures/go/variadic-function-declarations.diffA-B.txt +++ b/test/fixtures/go/variadic-function-declarations.diffA-B.txt @@ -9,33 +9,19 @@ (Empty) { (Identifier) ->(Identifier) } -<<<<<<< HEAD (Variadic (Pointer (Identifier)) (Identifier)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier) - (PointerTy - (Identifier))))) ->>>>>>> master (Function (Empty) { (Identifier) ->(Identifier) } -<<<<<<< HEAD (Variadic (Identifier) (Empty)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier)))) ->>>>>>> master (Function (Empty) { (Identifier) @@ -43,10 +29,5 @@ (Identifier) (Variadic (Identifier) -<<<<<<< HEAD (Empty)) ([]))) -======= - (Other "variadic_parameter_declaration" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/variadic-function-declarations.diffB-A.txt b/test/fixtures/go/variadic-function-declarations.diffB-A.txt index 1bc5da033..89196f558 100644 --- a/test/fixtures/go/variadic-function-declarations.diffB-A.txt +++ b/test/fixtures/go/variadic-function-declarations.diffB-A.txt @@ -9,33 +9,19 @@ (Empty) { (Identifier) ->(Identifier) } -<<<<<<< HEAD (Variadic (Pointer (Identifier)) (Identifier)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier) - (PointerTy - (Identifier))))) ->>>>>>> master (Function (Empty) { (Identifier) ->(Identifier) } -<<<<<<< HEAD (Variadic (Identifier) (Empty)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier)))) ->>>>>>> master (Function (Empty) { (Identifier) @@ -43,10 +29,5 @@ (Identifier) (Variadic (Identifier) -<<<<<<< HEAD (Empty)) ([]))) -======= - (Other "variadic_parameter_declaration" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/variadic-function-declarations.parseA.txt b/test/fixtures/go/variadic-function-declarations.parseA.txt index b342d89c3..4deeea5dc 100644 --- a/test/fixtures/go/variadic-function-declarations.parseA.txt +++ b/test/fixtures/go/variadic-function-declarations.parseA.txt @@ -8,42 +8,23 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD (Variadic (Pointer (Identifier)) (Identifier)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier) - (PointerTy - (Identifier))))) ->>>>>>> master (Function (Empty) (Identifier) -<<<<<<< HEAD (Variadic (Identifier) (Empty)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier)))) ->>>>>>> master (Function (Empty) (Identifier) (Identifier) (Variadic (Identifier) -<<<<<<< HEAD (Empty)) ([]))) -======= - (Other "variadic_parameter_declaration" - (Identifier))))) ->>>>>>> master diff --git a/test/fixtures/go/variadic-function-declarations.parseB.txt b/test/fixtures/go/variadic-function-declarations.parseB.txt index b342d89c3..4deeea5dc 100644 --- a/test/fixtures/go/variadic-function-declarations.parseB.txt +++ b/test/fixtures/go/variadic-function-declarations.parseB.txt @@ -8,42 +8,23 @@ (Function (Empty) (Identifier) -<<<<<<< HEAD (Variadic (Pointer (Identifier)) (Identifier)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier) - (PointerTy - (Identifier))))) ->>>>>>> master (Function (Empty) (Identifier) -<<<<<<< HEAD (Variadic (Identifier) (Empty)) ([])) -======= - (Args - (Other "variadic_parameter_declaration" - (Identifier)))) ->>>>>>> master (Function (Empty) (Identifier) (Identifier) (Variadic (Identifier) -<<<<<<< HEAD (Empty)) ([]))) -======= - (Other "variadic_parameter_declaration" - (Identifier))))) ->>>>>>> master From fcf453f759898d46a2400faf12426100de527ca1 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Wed, 8 Nov 2017 11:17:03 -0800 Subject: [PATCH 155/176] Add additional type conversion test cases --- .../go/type-conversion-expressions.A.go | 10 +++- .../go/type-conversion-expressions.B.go | 10 +++- .../type-conversion-expressions.diffA-B.txt | 46 +++++++++++++++++++ .../type-conversion-expressions.diffB-A.txt | 46 +++++++++++++++++++ .../go/type-conversion-expressions.parseA.txt | 38 +++++++++++++++ .../go/type-conversion-expressions.parseB.txt | 38 +++++++++++++++ 6 files changed, 186 insertions(+), 2 deletions(-) diff --git a/test/fixtures/go/type-conversion-expressions.A.go b/test/fixtures/go/type-conversion-expressions.A.go index c6d65a703..bcde6e873 100644 --- a/test/fixtures/go/type-conversion-expressions.A.go +++ b/test/fixtures/go/type-conversion-expressions.A.go @@ -1,7 +1,15 @@ package main func main() { -[]a.b(c.d) + *Point(p) + (*Point)(p) + <-chan int(c) + (<-chan int)(c) + func()(x) + (func())(x) + (func() int)(x) + func() int(x) + []a.b(c.d) ([]a.b)(c.d) e.f(g) (e.f)(g) diff --git a/test/fixtures/go/type-conversion-expressions.B.go b/test/fixtures/go/type-conversion-expressions.B.go index 4c4381a67..5ed8ef25a 100644 --- a/test/fixtures/go/type-conversion-expressions.B.go +++ b/test/fixtures/go/type-conversion-expressions.B.go @@ -1,7 +1,15 @@ package main func main() { -[]x.y(z.e) + *Point(q) + (*Point)(q) + <-chan int(d) + (<-chan int)(d) + func()(f) + (func())(f) + (func() int)(f) + func() int(f) + []x.y(z.e) ([]f.g)(h.i) j.k(l) (m.n)(o) diff --git a/test/fixtures/go/type-conversion-expressions.diffA-B.txt b/test/fixtures/go/type-conversion-expressions.diffA-B.txt index 6f401c55d..04fe6dc22 100644 --- a/test/fixtures/go/type-conversion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-conversion-expressions.diffA-B.txt @@ -5,6 +5,52 @@ (Empty) (Identifier) ( + (TypeConversion + (Pointer + (Identifier)) + { (Identifier) + ->(Identifier) }) + (Call + (Pointer + (Identifier)) + { (Identifier) + ->(Identifier) } + (Empty)) + (Receive + (Empty) + (TypeConversion + (BiDirectionalChannel + (Identifier)) + { (Identifier) + ->(Identifier) })) + (TypeConversion + (ParenthesizedType + (ReceiveChannel + (Identifier))) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (Function + (Empty)) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (ParenthesizedType + (Function + (Empty))) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (ParenthesizedType + (Function + (Identifier))) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (Function + (Identifier)) + { (Identifier) + ->(Identifier) }) (TypeConversion (Slice (MemberAccess diff --git a/test/fixtures/go/type-conversion-expressions.diffB-A.txt b/test/fixtures/go/type-conversion-expressions.diffB-A.txt index 6f401c55d..04fe6dc22 100644 --- a/test/fixtures/go/type-conversion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-conversion-expressions.diffB-A.txt @@ -5,6 +5,52 @@ (Empty) (Identifier) ( + (TypeConversion + (Pointer + (Identifier)) + { (Identifier) + ->(Identifier) }) + (Call + (Pointer + (Identifier)) + { (Identifier) + ->(Identifier) } + (Empty)) + (Receive + (Empty) + (TypeConversion + (BiDirectionalChannel + (Identifier)) + { (Identifier) + ->(Identifier) })) + (TypeConversion + (ParenthesizedType + (ReceiveChannel + (Identifier))) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (Function + (Empty)) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (ParenthesizedType + (Function + (Empty))) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (ParenthesizedType + (Function + (Identifier))) + { (Identifier) + ->(Identifier) }) + (TypeConversion + (Function + (Identifier)) + { (Identifier) + ->(Identifier) }) (TypeConversion (Slice (MemberAccess diff --git a/test/fixtures/go/type-conversion-expressions.parseA.txt b/test/fixtures/go/type-conversion-expressions.parseA.txt index fa2781a93..95c20290f 100644 --- a/test/fixtures/go/type-conversion-expressions.parseA.txt +++ b/test/fixtures/go/type-conversion-expressions.parseA.txt @@ -5,6 +5,44 @@ (Empty) (Identifier) ( + (TypeConversion + (Pointer + (Identifier)) + (Identifier)) + (Call + (Pointer + (Identifier)) + (Identifier) + (Empty)) + (Receive + (Empty) + (TypeConversion + (BiDirectionalChannel + (Identifier)) + (Identifier))) + (TypeConversion + (ParenthesizedType + (ReceiveChannel + (Identifier))) + (Identifier)) + (TypeConversion + (Function + (Empty)) + (Identifier)) + (TypeConversion + (ParenthesizedType + (Function + (Empty))) + (Identifier)) + (TypeConversion + (ParenthesizedType + (Function + (Identifier))) + (Identifier)) + (TypeConversion + (Function + (Identifier)) + (Identifier)) (TypeConversion (Slice (MemberAccess diff --git a/test/fixtures/go/type-conversion-expressions.parseB.txt b/test/fixtures/go/type-conversion-expressions.parseB.txt index fa2781a93..95c20290f 100644 --- a/test/fixtures/go/type-conversion-expressions.parseB.txt +++ b/test/fixtures/go/type-conversion-expressions.parseB.txt @@ -5,6 +5,44 @@ (Empty) (Identifier) ( + (TypeConversion + (Pointer + (Identifier)) + (Identifier)) + (Call + (Pointer + (Identifier)) + (Identifier) + (Empty)) + (Receive + (Empty) + (TypeConversion + (BiDirectionalChannel + (Identifier)) + (Identifier))) + (TypeConversion + (ParenthesizedType + (ReceiveChannel + (Identifier))) + (Identifier)) + (TypeConversion + (Function + (Empty)) + (Identifier)) + (TypeConversion + (ParenthesizedType + (Function + (Empty))) + (Identifier)) + (TypeConversion + (ParenthesizedType + (Function + (Identifier))) + (Identifier)) + (TypeConversion + (Function + (Identifier)) + (Identifier)) (TypeConversion (Slice (MemberAccess From 69c85f11401050a25495b501a93875f4d6e96e6a Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 14:25:22 -0800 Subject: [PATCH 156/176] Formatting --- src/Language/Go/Assignment.hs | 70 ++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index f26c6d01c..76474bca7 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -192,13 +192,15 @@ expressionChoices = identifiers :: Assignment identifiers = mk <$> location <*> many identifier - where mk _ [a] = a - mk loc children = makeTerm loc children + where + mk _ [a] = a + mk loc children = makeTerm loc children expressions :: Assignment expressions = mk <$> location <*> many expression - where mk _ [a] = a - mk loc children = makeTerm loc children + where + mk _ [a] = a + mk loc children = makeTerm loc children -- Literals @@ -262,16 +264,17 @@ implicitLengthArrayType = makeTerm <$> symbol ImplicitLengthArrayType <*> childr functionType :: Assignment functionType = makeTerm <$> symbol FunctionType <*> children (Type.Function <$> parameters <*> returnType) - where parameters = symbol Parameters *> children (many expression) - returnType = symbol Parameters *> children expressions <|> expression <|> emptyTerm + where + parameters = symbol Parameters *> children (many expression) + returnType = symbol Parameters *> children expressions <|> expression <|> emptyTerm sliceType :: Assignment sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression) channelType :: Assignment -channelType = (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) - <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression)))) - <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> (Type.BiDirectionalChannel <$> expression)))) +channelType = (makeTerm <$> symbol ChannelType <*> (children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression)))) + <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) + <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> (Type.BiDirectionalChannel <$> expression)))) structType :: Assignment structType = handleError $ makeTerm <$> symbol StructType <*> children (Declaration.Constructor <$> emptyTerm <*> many expression) @@ -370,12 +373,13 @@ typeConversion = makeTerm <$> symbol TypeConversionExpression <*> children (Go.S unaryExpression :: Assignment unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive <|> unaryPointer - where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) - unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) - unaryPlus = children (symbol AnonPlus *> expression) - unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Literal.Reference <$> expression)) - unaryReceive = children (makeTerm <$> symbol AnonLAngleMinus <*> (Go.Syntax.Receive <$> emptyTerm <*> expression)) - unaryPointer = children (makeTerm <$> symbol AnonStar <*> (Literal.Pointer <$> expression)) + where + notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) + unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) + unaryPlus = children (symbol AnonPlus *> expression) + unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Literal.Reference <$> expression)) + unaryReceive = children (makeTerm <$> symbol AnonLAngleMinus <*> (Go.Syntax.Receive <$> emptyTerm <*> expression)) + unaryPointer = children (makeTerm <$> symbol AnonStar <*> (Literal.Pointer <$> expression)) binaryExpression :: Assignment binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression @@ -399,7 +403,8 @@ binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm , (inj .) . Expression.LShift <$ symbol AnonLAngleLAngle , (inj .) . Expression.RShift <$ symbol AnonRAngleRAngle ]) - where invert cons a b = Expression.Not (makeTerm1 (cons a b)) + where + invert cons a b = Expression.Not (makeTerm1 (cons a b)) block :: Assignment block = symbol Block *> children expressions @@ -448,14 +453,9 @@ varDeclaration :: Assignment varDeclaration = (symbol ConstDeclaration <|> symbol VarDeclaration) *> children expressions varSpecification :: Assignment -varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment - <$> pure [] - <*> (annotatedLHS <|> identifiers) - <*> expressions) +varSpecification = makeTerm <$> (symbol ConstSpec <|> symbol VarSpec) <*> children (Statement.Assignment <$> pure [] <*> (annotatedLHS <|> identifiers) <*> expressions) where - annotatedLHS = makeTerm <$> location <*> (Type.Annotation - <$> (makeTerm <$> location <*> (manyTermsTill identifier (void (symbol TypeIdentifier)))) - <*> expression) + annotatedLHS = makeTerm <$> location <*> (Type.Annotation <$> (makeTerm <$> location <*> (manyTermsTill identifier (void (symbol TypeIdentifier)))) <*> expression) expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions @@ -463,9 +463,10 @@ expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) - where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') - parameters = symbol Parameters *> children (many expression) - returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) + where + mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') + parameters = symbol Parameters *> children (many expression) + returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) variadicParameterDeclaration :: Assignment variadicParameterDeclaration = mkVariadic <$> symbol VariadicParameterDeclaration <*> children ((,) <$> emptyTerm <*> expression) @@ -481,17 +482,18 @@ importSpec = symbol ImportSpec *> children expressions methodDeclaration :: Assignment methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> (typeIdentifier <|> emptyTerm) <*> block) - where parameters = symbol Parameters *> children ((symbol ParameterDeclaration *> children (many expression)) - <|> many emptyTerm) - receiver = symbol Parameters *> children (symbol ParameterDeclaration *> children expressions) - mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') + where + parameters = symbol Parameters *> children ((symbol ParameterDeclaration *> children (many expression)) <|> many emptyTerm) + receiver = symbol Parameters *> children (symbol ParameterDeclaration *> children expressions) + mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') methodSpec :: Assignment methodSpec = mkMethodSpec <$> symbol MethodSpec <*> children ((,,,,) <$> empty <*> expression <*> parameters <*> (expression <|> parameters <|> emptyTerm) <*> empty) - where parameters = makeTerm <$> symbol Parameters <*> children (many expression) - empty = makeTerm <$> location <*> pure Syntax.Empty - mkMethodSpec loc (receiver', name', params, optionaltypeLiteral, body') = makeTerm loc $ Type.Annotation (mkMethod loc receiver' name' params body') optionaltypeLiteral - mkMethod loc empty' name' params empty'' = makeTerm loc $ Declaration.Method [] empty' name' (pure params) empty'' + where + parameters = makeTerm <$> symbol Parameters <*> children (many expression) + empty = makeTerm <$> location <*> pure Syntax.Empty + mkMethodSpec loc (receiver', name', params, optionaltypeLiteral, body') = makeTerm loc $ Type.Annotation (mkMethod loc receiver' name' params body') optionaltypeLiteral + mkMethod loc empty' name' params empty'' = makeTerm loc $ Declaration.Method [] empty' name' (pure params) empty'' packageClause :: Assignment packageClause = makeTerm <$> symbol PackageClause <*> children (Declaration.Module <$> expression <*> pure []) From 8a78c17a40dab4c180abf8e1af501ccd4c9f7478 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 14:26:47 -0800 Subject: [PATCH 157/176] Add arrayType assignment to top level expression choices --- src/Language/Go/Assignment.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 76474bca7..335f5c82c 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -111,6 +111,7 @@ expression = term (handleError (choice expressionChoices)) expressionChoices :: [Assignment.Assignment [] Grammar Term] expressionChoices = [ assignment' + , arrayType , binaryExpression , block , breakStatement From ab2839d9251cd049975cb5945c0cd33cc151c95b Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 15:00:33 -0800 Subject: [PATCH 158/176] Assign for statements with a single expression condition --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 335f5c82c..6237bd4cf 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -566,7 +566,7 @@ elseClause :: Assignment elseClause = symbol ElseClause *> children expression forStatement :: Assignment -forStatement = mkForStatement <$> symbol ForStatement <*> children ((,) <$> (forClause <|> rangeClause <|> emptyClause) <*> expression) +forStatement = mkForStatement <$> symbol ForStatement <*> children ((,) <$> (forClause <|> rangeClause <|> for <|> emptyClause) <*> expression) where mkForStatement loc ((constructor, a, b, c), block') = case (constructor :: [Char]) of "forEach" -> makeTerm loc $ (Statement.ForEach a b block') @@ -578,6 +578,7 @@ forStatement = mkForStatement <$> symbol ForStatement <*> children ((,) <$> (for <|> (("for",,,) <$> expression <*> expression <*> emptyTerm) <|> (("for",,,) <$> expression <*> emptyTerm <*> emptyTerm) <|> (("for",,,) <$> emptyTerm <*> emptyTerm <*> emptyTerm)) + for = ("for",,,) <$> emptyTerm <*> expression <*> emptyTerm incStatement :: Assignment incStatement = makeTerm <$> symbol IncStatement <*> children (Statement.PostIncrement <$> expression) From 86c7892fe2e3467e52ad6cd5243d8d7fb5e6ea8f Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 15:41:55 -0800 Subject: [PATCH 159/176] Update for statement tests --- test/fixtures/go/for-statements.A.go | 3 +++ test/fixtures/go/for-statements.B.go | 3 +++ test/fixtures/go/for-statements.diffA-B.txt | 18 ++++++++++++++++++ test/fixtures/go/for-statements.diffB-A.txt | 18 ++++++++++++++++++ test/fixtures/go/for-statements.parseA.txt | 9 +++++++++ test/fixtures/go/for-statements.parseB.txt | 9 +++++++++ 6 files changed, 60 insertions(+) diff --git a/test/fixtures/go/for-statements.A.go b/test/fixtures/go/for-statements.A.go index fd1d92790..a7d6395f8 100644 --- a/test/fixtures/go/for-statements.A.go +++ b/test/fixtures/go/for-statements.A.go @@ -27,5 +27,8 @@ for i, s := range a { for key, val = range m { h(key, val) } +for 1 < 2 { + i() +} for range ch {} } diff --git a/test/fixtures/go/for-statements.B.go b/test/fixtures/go/for-statements.B.go index 3a427a0dd..4bf4f6252 100644 --- a/test/fixtures/go/for-statements.B.go +++ b/test/fixtures/go/for-statements.B.go @@ -27,5 +27,8 @@ for s, i := range b { for k, v = range m { h(k, v) } +for 2 < 1 { + j() +} for range b {} } diff --git a/test/fixtures/go/for-statements.diffA-B.txt b/test/fixtures/go/for-statements.diffA-B.txt index 5be234393..0c2cb3bfb 100644 --- a/test/fixtures/go/for-statements.diffA-B.txt +++ b/test/fixtures/go/for-statements.diffA-B.txt @@ -88,6 +88,15 @@ {+(Identifier)+} {+(Identifier)+} {+(Empty)+})+})+} + {+(For + {+(Empty)+} + {+(LessThan + {+(Integer)+} + {+(Integer)+})+} + {+(Empty)+} + {+(Call + {+(Identifier)+} + {+(Empty)+})+})+} {+(ForEach {+(Empty)+} {+(Identifier)+} @@ -145,6 +154,15 @@ {-(Identifier)-} {-(Identifier)-} {-(Empty)-})-})-} + {-(For + {-(Empty)-} + {-(LessThan + {-(Integer)-} + {-(Integer)-})-} + {-(Empty)-} + {-(Call + {-(Identifier)-} + {-(Empty)-})-})-} {-(ForEach {-(Empty)-} {-(Identifier)-} diff --git a/test/fixtures/go/for-statements.diffB-A.txt b/test/fixtures/go/for-statements.diffB-A.txt index 6f4b2c152..93d80b429 100644 --- a/test/fixtures/go/for-statements.diffB-A.txt +++ b/test/fixtures/go/for-statements.diffB-A.txt @@ -84,6 +84,15 @@ {+(Identifier)+} {+(Identifier)+} {+(Empty)+})+})+} + {+(For + {+(Empty)+} + {+(LessThan + {+(Integer)+} + {+(Integer)+})+} + {+(Empty)+} + {+(Call + {+(Identifier)+} + {+(Empty)+})+})+} {+(ForEach {+(Empty)+} {+(Identifier)+} @@ -142,6 +151,15 @@ {-(Identifier)-} {-(Identifier)-} {-(Empty)-})-})-} + {-(For + {-(Empty)-} + {-(LessThan + {-(Integer)-} + {-(Integer)-})-} + {-(Empty)-} + {-(Call + {-(Identifier)-} + {-(Empty)-})-})-} {-(ForEach {-(Empty)-} {-(Identifier)-} diff --git a/test/fixtures/go/for-statements.parseA.txt b/test/fixtures/go/for-statements.parseA.txt index e80cd9800..dacb795c9 100644 --- a/test/fixtures/go/for-statements.parseA.txt +++ b/test/fixtures/go/for-statements.parseA.txt @@ -83,6 +83,15 @@ (Identifier) (Identifier) (Empty))) + (For + (Empty) + (LessThan + (Integer) + (Integer)) + (Empty) + (Call + (Identifier) + (Empty))) (ForEach (Empty) (Identifier) diff --git a/test/fixtures/go/for-statements.parseB.txt b/test/fixtures/go/for-statements.parseB.txt index a52cd0cee..af680b601 100644 --- a/test/fixtures/go/for-statements.parseB.txt +++ b/test/fixtures/go/for-statements.parseB.txt @@ -78,6 +78,15 @@ (Identifier) (Identifier) (Empty))) + (For + (Empty) + (LessThan + (Integer) + (Integer)) + (Empty) + (Call + (Identifier) + (Empty))) (ForEach (Empty) (Identifier) From b4bdbc7cfb401c7653067738eb1a48036cf495eb Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 15:58:30 -0800 Subject: [PATCH 160/176] Allow single identifiers in method declaration parameter list --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 6237bd4cf..ed7ba490a 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -484,7 +484,8 @@ importSpec = symbol ImportSpec *> children expressions methodDeclaration :: Assignment methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> (typeIdentifier <|> emptyTerm) <*> block) where - parameters = symbol Parameters *> children ((symbol ParameterDeclaration *> children (many expression)) <|> many emptyTerm) + parameterDeclaration = symbol ParameterDeclaration *> (children (many expression) <|> many emptyTerm) + parameters = symbol Parameters *> children (parameterDeclaration <|> many expression) receiver = symbol Parameters *> children (symbol ParameterDeclaration *> children expressions) mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') From 4eb9d19f9c60bd0163512d1c4c87584795f431e0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 16:21:36 -0800 Subject: [PATCH 161/176] Update method declaration fixtures and tests --- test/fixtures/go/method-declarations.A.go | 2 ++ test/fixtures/go/method-declarations.B.go | 2 ++ .../fixtures/go/method-declarations.diffA-B.txt | 17 +++++++++++++++-- .../fixtures/go/method-declarations.diffB-A.txt | 17 +++++++++++++++-- test/fixtures/go/method-declarations.parseA.txt | 15 +++++++++++++-- test/fixtures/go/method-declarations.parseB.txt | 15 +++++++++++++-- 6 files changed, 60 insertions(+), 8 deletions(-) diff --git a/test/fixtures/go/method-declarations.A.go b/test/fixtures/go/method-declarations.A.go index b8df97ef1..fc2c62578 100644 --- a/test/fixtures/go/method-declarations.A.go +++ b/test/fixtures/go/method-declarations.A.go @@ -12,3 +12,5 @@ func (p *Point) Scale(factor float64) { p.x *= factor p.y *= factor } + +func (f *Field) Alive(x, y int) bool { } diff --git a/test/fixtures/go/method-declarations.B.go b/test/fixtures/go/method-declarations.B.go index 8e685dc6d..482af2b85 100644 --- a/test/fixtures/go/method-declarations.B.go +++ b/test/fixtures/go/method-declarations.B.go @@ -12,3 +12,5 @@ func (q *Point) Scale(factor int) { p.x *= factor p.y *= factor } + +func (f *Field) Alive(z, h int) bool { } diff --git a/test/fixtures/go/method-declarations.diffA-B.txt b/test/fixtures/go/method-declarations.diffA-B.txt index 3e0f8c3e0..1886dc33e 100644 --- a/test/fixtures/go/method-declarations.diffA-B.txt +++ b/test/fixtures/go/method-declarations.diffA-B.txt @@ -24,7 +24,6 @@ (Identifier))) { (Identifier) ->(Identifier) } - (Empty) (Return (Call (MemberAccess @@ -101,4 +100,18 @@ (MemberAccess (Identifier) (Identifier)) - (Identifier)))))) + (Identifier))))) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + { (Identifier) + ->(Identifier) } + ( + { (Identifier) + ->(Identifier) } + (Identifier)) + ([]))) diff --git a/test/fixtures/go/method-declarations.diffB-A.txt b/test/fixtures/go/method-declarations.diffB-A.txt index cd861c245..77dcd4192 100644 --- a/test/fixtures/go/method-declarations.diffB-A.txt +++ b/test/fixtures/go/method-declarations.diffB-A.txt @@ -24,7 +24,6 @@ (Identifier))) { (Identifier) ->(Identifier) } - (Empty) (Return (Call (MemberAccess @@ -101,4 +100,18 @@ (MemberAccess (Identifier) (Identifier)) - (Identifier)))))) + (Identifier))))) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + { (Identifier) + ->(Identifier) } + ( + { (Identifier) + ->(Identifier) } + (Identifier)) + ([]))) diff --git a/test/fixtures/go/method-declarations.parseA.txt b/test/fixtures/go/method-declarations.parseA.txt index 67eb3280f..fb698d9fa 100644 --- a/test/fixtures/go/method-declarations.parseA.txt +++ b/test/fixtures/go/method-declarations.parseA.txt @@ -21,7 +21,6 @@ (Pointer (Identifier))) (Identifier) - (Empty) (Return (Call (MemberAccess @@ -70,4 +69,16 @@ (MemberAccess (Identifier) (Identifier)) - (Identifier)))))) + (Identifier))))) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + (Identifier) + ( + (Identifier) + (Identifier)) + ([]))) diff --git a/test/fixtures/go/method-declarations.parseB.txt b/test/fixtures/go/method-declarations.parseB.txt index f3b3be03b..b3056cf0d 100644 --- a/test/fixtures/go/method-declarations.parseB.txt +++ b/test/fixtures/go/method-declarations.parseB.txt @@ -21,7 +21,6 @@ (Pointer (Identifier))) (Identifier) - (Empty) (Return (Call (MemberAccess @@ -82,4 +81,16 @@ (MemberAccess (Identifier) (Identifier)) - (Identifier)))))) + (Identifier))))) + (Method + (Identifier) + ( + (Identifier) + (Pointer + (Identifier))) + (Identifier) + (Identifier) + ( + (Identifier) + (Identifier)) + ([]))) From eaa98db6fd16b6708a2ba253fba1676cb885e5ca Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 16:39:48 -0800 Subject: [PATCH 162/176] Assign identifiers for the receiver of method declarations --- src/Language/Go/Assignment.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ed7ba490a..67dc79001 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -482,11 +482,11 @@ importSpec :: Assignment importSpec = symbol ImportSpec *> children expressions methodDeclaration :: Assignment -methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> (typeIdentifier <|> emptyTerm) <*> block) +methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> (expression <|> emptyTerm) <*> block) where parameterDeclaration = symbol ParameterDeclaration *> (children (many expression) <|> many emptyTerm) parameters = symbol Parameters *> children (parameterDeclaration <|> many expression) - receiver = symbol Parameters *> children (symbol ParameterDeclaration *> children expressions) + receiver = symbol Parameters *> children ((symbol ParameterDeclaration *> children expressions) <|> expressions) mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') methodSpec :: Assignment From 8b723fdaa86ca66d42393db04dce689035d8f839 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 16:58:03 -0800 Subject: [PATCH 163/176] Assign parameters and parameterDeclarations consistently --- src/Language/Go/Assignment.hs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 67dc79001..edea1b7d2 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -163,6 +163,7 @@ expressionChoices = , packageClause , packageIdentifier , parameterDeclaration + , parameters , parenthesizedExpression , parenthesizedType , pointerType @@ -264,9 +265,8 @@ implicitLengthArrayType :: Assignment implicitLengthArrayType = makeTerm <$> symbol ImplicitLengthArrayType <*> children (Type.Array Nothing <$> expression) functionType :: Assignment -functionType = makeTerm <$> symbol FunctionType <*> children (Type.Function <$> parameters <*> returnType) +functionType = makeTerm <$> symbol FunctionType <*> children (Type.Function <$> many parameters <*> returnType) where - parameters = symbol Parameters *> children (many expression) returnType = symbol Parameters *> children expressions <|> expression <|> emptyTerm sliceType :: Assignment @@ -462,11 +462,10 @@ expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment -functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) - <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) +functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) + <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') - parameters = symbol Parameters *> children (many expression) returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) variadicParameterDeclaration :: Assignment @@ -481,18 +480,21 @@ importDeclaration = makeTerm <$> symbol ImportDeclaration <*> children (Declarat importSpec :: Assignment importSpec = symbol ImportSpec *> children expressions +parameters :: Assignment +parameters = makeTerm <$> symbol Parameters <*> children (many expression) + +parameterDeclaration :: Assignment +parameterDeclaration = makeTerm <$> symbol ParameterDeclaration <*> children (many expression) + methodDeclaration :: Assignment -methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> parameters <*> (expression <|> emptyTerm) <*> block) +methodDeclaration = mkTypedMethodDeclaration <$> symbol MethodDeclaration <*> children ((,,,,) <$> receiver <*> fieldIdentifier <*> many parameters <*> (expression <|> emptyTerm) <*> block) where - parameterDeclaration = symbol ParameterDeclaration *> (children (many expression) <|> many emptyTerm) - parameters = symbol Parameters *> children (parameterDeclaration <|> many expression) receiver = symbol Parameters *> children ((symbol ParameterDeclaration *> children expressions) <|> expressions) mkTypedMethodDeclaration loc (receiver', name', parameters', type'', body') = makeTerm loc (Declaration.Method [type''] receiver' name' parameters' body') methodSpec :: Assignment methodSpec = mkMethodSpec <$> symbol MethodSpec <*> children ((,,,,) <$> empty <*> expression <*> parameters <*> (expression <|> parameters <|> emptyTerm) <*> empty) where - parameters = makeTerm <$> symbol Parameters <*> children (many expression) empty = makeTerm <$> location <*> pure Syntax.Empty mkMethodSpec loc (receiver', name', params, optionaltypeLiteral, body') = makeTerm loc $ Type.Annotation (mkMethod loc receiver' name' params body') optionaltypeLiteral mkMethod loc empty' name' params empty'' = makeTerm loc $ Declaration.Method [] empty' name' (pure params) empty'' @@ -500,9 +502,6 @@ methodSpec = mkMethodSpec <$> symbol MethodSpec <*> children ((,,,,) <$> empty packageClause :: Assignment packageClause = makeTerm <$> symbol PackageClause <*> children (Declaration.Module <$> expression <*> pure []) -parameterDeclaration :: Assignment -parameterDeclaration = symbol ParameterDeclaration *> children expressions - -- Statements From 59cb4b2bc7580f80d35187c59ee7dd4a8d26bb52 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Thu, 9 Nov 2017 17:01:19 -0800 Subject: [PATCH 164/176] Update tests --- test/fixtures/go/array-types.diffA-B.txt | 1 + test/fixtures/go/array-types.diffB-A.txt | 1 + test/fixtures/go/array-types.parseA.txt | 1 + test/fixtures/go/array-types.parseB.txt | 1 + .../go/array-with-implicit-length.diffA-B.txt | 1 + .../go/array-with-implicit-length.diffB-A.txt | 1 + .../go/array-with-implicit-length.parseA.txt | 1 + .../go/array-with-implicit-length.parseB.txt | 1 + .../go/assignment-statements.diffA-B.txt | 1 + .../go/assignment-statements.diffB-A.txt | 1 + .../go/assignment-statements.parseA.txt | 1 + .../go/assignment-statements.parseB.txt | 1 + test/fixtures/go/call-expressions.diffA-B.txt | 1 + test/fixtures/go/call-expressions.diffB-A.txt | 1 + test/fixtures/go/call-expressions.parseA.txt | 1 + test/fixtures/go/call-expressions.parseB.txt | 1 + test/fixtures/go/case-statements.diffA-B.txt | 1 + test/fixtures/go/case-statements.diffB-A.txt | 1 + test/fixtures/go/case-statements.parseA.txt | 1 + test/fixtures/go/case-statements.parseB.txt | 1 + test/fixtures/go/channel-types.diffA-B.txt | 22 ++++++------ test/fixtures/go/channel-types.diffB-A.txt | 5 +-- test/fixtures/go/channel-types.parseA.txt | 5 +-- test/fixtures/go/channel-types.parseB.txt | 5 +-- test/fixtures/go/comment.diffA-B.txt | 1 + test/fixtures/go/comment.diffB-A.txt | 1 + test/fixtures/go/comment.parseA.txt | 1 + test/fixtures/go/comment.parseB.txt | 1 + .../const-declarations-with-types.diffA-B.txt | 1 + .../const-declarations-with-types.diffB-A.txt | 1 + .../const-declarations-with-types.parseA.txt | 1 + .../const-declarations-with-types.parseB.txt | 1 + ...nst-declarations-without-types.diffA-B.txt | 1 + ...nst-declarations-without-types.diffB-A.txt | 1 + ...onst-declarations-without-types.parseA.txt | 1 + ...onst-declarations-without-types.parseB.txt | 1 + .../go/const-with-implicit-values.diffA-B.txt | 1 + .../go/const-with-implicit-values.diffB-A.txt | 1 + .../go/const-with-implicit-values.parseA.txt | 1 + .../go/const-with-implicit-values.parseB.txt | 1 + test/fixtures/go/constructors.diffA-B.txt | 1 + test/fixtures/go/constructors.diffB-A.txt | 1 + test/fixtures/go/constructors.parseA.txt | 1 + test/fixtures/go/constructors.parseB.txt | 1 + test/fixtures/go/float-literals.diffA-B.txt | 1 + test/fixtures/go/float-literals.diffB-A.txt | 1 + test/fixtures/go/float-literals.parseA.txt | 1 + test/fixtures/go/float-literals.parseB.txt | 1 + test/fixtures/go/for-statements.diffA-B.txt | 1 + test/fixtures/go/for-statements.diffB-A.txt | 1 + test/fixtures/go/for-statements.parseA.txt | 1 + test/fixtures/go/for-statements.parseB.txt | 1 + .../go/function-declarations.diffA-B.txt | 31 +++++++++++------ .../go/function-declarations.diffB-A.txt | 31 +++++++++++------ .../go/function-declarations.parseA.txt | 23 ++++++++----- .../go/function-declarations.parseB.txt | 27 ++++++++++----- .../fixtures/go/function-literals.diffA-B.txt | 13 ++++--- .../fixtures/go/function-literals.diffB-A.txt | 13 ++++--- test/fixtures/go/function-literals.parseA.txt | 9 +++-- test/fixtures/go/function-literals.parseB.txt | 9 +++-- test/fixtures/go/function-types.diffA-B.txt | 21 +++++++----- test/fixtures/go/function-types.diffB-A.txt | 21 +++++++----- test/fixtures/go/function-types.parseA.txt | 12 ++++--- test/fixtures/go/function-types.parseB.txt | 17 ++++++---- .../go/go-and-defer-statements.diffA-B.txt | 1 + .../go/go-and-defer-statements.diffB-A.txt | 1 + .../go/go-and-defer-statements.parseA.txt | 1 + .../go/go-and-defer-statements.parseB.txt | 1 + .../grouped-import-declarations.diffA-B.txt | 1 + .../grouped-import-declarations.diffB-A.txt | 1 + .../go/grouped-import-declarations.parseA.txt | 1 + .../go/grouped-import-declarations.parseB.txt | 1 + .../go/grouped-var-declarations.diffA-B.txt | 1 + .../go/grouped-var-declarations.diffB-A.txt | 1 + .../go/grouped-var-declarations.parseA.txt | 1 + .../go/grouped-var-declarations.parseB.txt | 1 + test/fixtures/go/if-statements.diffA-B.txt | 1 + test/fixtures/go/if-statements.diffB-A.txt | 1 + test/fixtures/go/if-statements.parseA.txt | 1 + test/fixtures/go/if-statements.parseB.txt | 1 + .../go/imaginary-literals.diffA-B.txt | 1 + .../go/imaginary-literals.diffB-A.txt | 1 + .../fixtures/go/imaginary-literals.parseA.txt | 1 + .../fixtures/go/imaginary-literals.parseB.txt | 1 + ...increment-decrement-statements.diffA-B.txt | 1 + ...increment-decrement-statements.diffB-A.txt | 1 + .../increment-decrement-statements.parseA.txt | 1 + .../increment-decrement-statements.parseB.txt | 1 + .../go/indexing-expressions.diffA-B.txt | 1 + .../go/indexing-expressions.diffB-A.txt | 1 + .../go/indexing-expressions.parseA.txt | 1 + .../go/indexing-expressions.parseB.txt | 1 + test/fixtures/go/int-literals.diffA-B.txt | 1 + test/fixtures/go/int-literals.diffB-A.txt | 1 + test/fixtures/go/int-literals.parseA.txt | 1 + test/fixtures/go/int-literals.parseB.txt | 1 + test/fixtures/go/interface-types.diffA-B.txt | 1 + test/fixtures/go/interface-types.diffB-A.txt | 1 + test/fixtures/go/interface-types.parseA.txt | 1 + test/fixtures/go/interface-types.parseB.txt | 1 + test/fixtures/go/label-statements.diffA-B.txt | 1 + test/fixtures/go/label-statements.diffB-A.txt | 1 + test/fixtures/go/label-statements.parseA.txt | 1 + test/fixtures/go/label-statements.parseB.txt | 1 + test/fixtures/go/map-literals.diffA-B.txt | 1 + test/fixtures/go/map-literals.diffB-A.txt | 1 + test/fixtures/go/map-literals.parseA.txt | 1 + test/fixtures/go/map-literals.parseB.txt | 1 + test/fixtures/go/map-types.diffA-B.txt | 1 + test/fixtures/go/map-types.diffB-A.txt | 1 + test/fixtures/go/map-types.parseA.txt | 1 + test/fixtures/go/map-types.parseB.txt | 1 + .../go/method-declarations.diffA-B.txt | 25 +++++++++----- .../go/method-declarations.diffB-A.txt | 25 +++++++++----- .../go/method-declarations.parseA.txt | 19 +++++++---- .../go/method-declarations.parseB.txt | 19 +++++++---- .../go/modifying-struct-fields.diffA-B.txt | 1 + .../go/modifying-struct-fields.diffB-A.txt | 1 + .../go/modifying-struct-fields.parseA.txt | 1 + .../go/modifying-struct-fields.parseB.txt | 1 + ...ameter-declarations-with-types.diffA-B.txt | 20 ++++++----- ...ameter-declarations-with-types.diffB-A.txt | 20 ++++++----- ...rameter-declarations-with-types.parseA.txt | 12 ++++--- ...rameter-declarations-with-types.parseB.txt | 12 ++++--- test/fixtures/go/pointer-types.diffA-B.txt | 1 + test/fixtures/go/pointer-types.diffB-A.txt | 1 + test/fixtures/go/pointer-types.parseA.txt | 1 + test/fixtures/go/pointer-types.parseB.txt | 1 + test/fixtures/go/qualified-types.diffA-B.txt | 1 + test/fixtures/go/qualified-types.diffB-A.txt | 1 + test/fixtures/go/qualified-types.parseA.txt | 1 + test/fixtures/go/qualified-types.parseB.txt | 1 + .../fixtures/go/select-statements.diffA-B.txt | 1 + .../fixtures/go/select-statements.diffB-A.txt | 1 + test/fixtures/go/select-statements.parseA.txt | 1 + test/fixtures/go/select-statements.parseB.txt | 1 + .../go/selector-expressions.diffA-B.txt | 1 + .../go/selector-expressions.diffB-A.txt | 1 + .../go/selector-expressions.parseA.txt | 1 + .../go/selector-expressions.parseB.txt | 1 + test/fixtures/go/send-statements.diffA-B.txt | 1 + test/fixtures/go/send-statements.diffB-A.txt | 1 + test/fixtures/go/send-statements.parseA.txt | 1 + test/fixtures/go/send-statements.parseB.txt | 1 + .../go/short-var-declarations.diffA-B.txt | 1 + .../go/short-var-declarations.diffB-A.txt | 1 + .../go/short-var-declarations.parseA.txt | 1 + .../go/short-var-declarations.parseB.txt | 1 + .../go/single-import-declarations.diffA-B.txt | 1 + .../go/single-import-declarations.diffB-A.txt | 1 + .../go/single-import-declarations.parseA.txt | 1 + .../go/single-import-declarations.parseB.txt | 1 + ...gle-line-function-declarations.diffA-B.txt | 4 +++ ...gle-line-function-declarations.diffB-A.txt | 4 +++ ...ngle-line-function-declarations.parseA.txt | 4 +++ ...ngle-line-function-declarations.parseB.txt | 4 +++ test/fixtures/go/slice-literals.diffA-B.txt | 1 + test/fixtures/go/slice-literals.diffB-A.txt | 1 + test/fixtures/go/slice-literals.parseA.txt | 1 + test/fixtures/go/slice-literals.parseB.txt | 1 + test/fixtures/go/slice-types.diffA-B.txt | 1 + test/fixtures/go/slice-types.diffB-A.txt | 1 + test/fixtures/go/slice-types.parseA.txt | 1 + test/fixtures/go/slice-types.parseB.txt | 1 + test/fixtures/go/string-literals.diffA-B.txt | 1 + test/fixtures/go/string-literals.diffB-A.txt | 1 + test/fixtures/go/string-literals.parseA.txt | 1 + test/fixtures/go/string-literals.parseB.txt | 1 + .../go/struct-field-declarations.diffA-B.txt | 1 + .../go/struct-field-declarations.diffB-A.txt | 1 + .../go/struct-field-declarations.parseA.txt | 1 + .../go/struct-field-declarations.parseB.txt | 1 + test/fixtures/go/struct-literals.diffA-B.txt | 1 + test/fixtures/go/struct-literals.diffB-A.txt | 1 + test/fixtures/go/struct-literals.parseA.txt | 1 + test/fixtures/go/struct-literals.parseB.txt | 1 + test/fixtures/go/struct-types.diffA-B.txt | 1 + test/fixtures/go/struct-types.diffB-A.txt | 1 + test/fixtures/go/struct-types.parseA.txt | 1 + test/fixtures/go/struct-types.parseB.txt | 1 + .../fixtures/go/switch-statements.diffA-B.txt | 1 + .../fixtures/go/switch-statements.diffB-A.txt | 1 + test/fixtures/go/switch-statements.parseA.txt | 1 + test/fixtures/go/switch-statements.parseB.txt | 1 + test/fixtures/go/type-aliases.diffA-B.txt | 1 + test/fixtures/go/type-aliases.diffB-A.txt | 1 + test/fixtures/go/type-aliases.parseA.txt | 1 + test/fixtures/go/type-aliases.parseB.txt | 1 + .../go/type-assertion-expressions.diffA-B.txt | 1 + .../go/type-assertion-expressions.diffB-A.txt | 1 + .../go/type-assertion-expressions.parseA.txt | 1 + .../go/type-assertion-expressions.parseB.txt | 1 + .../type-conversion-expressions.diffA-B.txt | 17 ++++++---- .../type-conversion-expressions.diffB-A.txt | 17 ++++++---- .../go/type-conversion-expressions.parseA.txt | 15 ++++---- .../go/type-conversion-expressions.parseB.txt | 15 ++++---- .../fixtures/go/type-declarations.diffA-B.txt | 1 + .../fixtures/go/type-declarations.diffB-A.txt | 1 + test/fixtures/go/type-declarations.parseA.txt | 1 + test/fixtures/go/type-declarations.parseB.txt | 1 + .../go/type-switch-statements.diffA-B.txt | 1 + .../go/type-switch-statements.diffB-A.txt | 1 + .../go/type-switch-statements.parseA.txt | 1 + .../go/type-switch-statements.parseB.txt | 1 + .../fixtures/go/unary-expressions.diffA-B.txt | 1 + .../fixtures/go/unary-expressions.diffB-A.txt | 1 + test/fixtures/go/unary-expressions.parseA.txt | 1 + test/fixtures/go/unary-expressions.parseB.txt | 1 + ...clarations-with-no-expressions.diffA-B.txt | 1 + ...clarations-with-no-expressions.diffB-A.txt | 1 + ...eclarations-with-no-expressions.parseA.txt | 1 + ...eclarations-with-no-expressions.parseB.txt | 1 + .../var-declarations-with-types.diffA-B.txt | 1 + .../var-declarations-with-types.diffB-A.txt | 1 + .../go/var-declarations-with-types.parseA.txt | 1 + .../go/var-declarations-with-types.parseB.txt | 1 + ...var-declarations-without-types.diffA-B.txt | 1 + ...var-declarations-without-types.diffB-A.txt | 1 + .../var-declarations-without-types.parseA.txt | 1 + .../var-declarations-without-types.parseB.txt | 1 + ...variadic-function-declarations.diffA-B.txt | 34 +++++++++++-------- ...variadic-function-declarations.diffB-A.txt | 34 +++++++++++-------- .../variadic-function-declarations.parseA.txt | 32 +++++++++-------- .../variadic-function-declarations.parseB.txt | 32 +++++++++-------- 224 files changed, 576 insertions(+), 240 deletions(-) diff --git a/test/fixtures/go/array-types.diffA-B.txt b/test/fixtures/go/array-types.diffA-B.txt index 1bdf4a4f8..829f5afd6 100644 --- a/test/fixtures/go/array-types.diffA-B.txt +++ b/test/fixtures/go/array-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/array-types.diffB-A.txt b/test/fixtures/go/array-types.diffB-A.txt index 1bdf4a4f8..829f5afd6 100644 --- a/test/fixtures/go/array-types.diffB-A.txt +++ b/test/fixtures/go/array-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/array-types.parseA.txt b/test/fixtures/go/array-types.parseA.txt index 02dbfdd8b..d10bf946f 100644 --- a/test/fixtures/go/array-types.parseA.txt +++ b/test/fixtures/go/array-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/array-types.parseB.txt b/test/fixtures/go/array-types.parseB.txt index 02dbfdd8b..d10bf946f 100644 --- a/test/fixtures/go/array-types.parseB.txt +++ b/test/fixtures/go/array-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/array-with-implicit-length.diffA-B.txt b/test/fixtures/go/array-with-implicit-length.diffA-B.txt index fe87c3001..ae0923f80 100644 --- a/test/fixtures/go/array-with-implicit-length.diffA-B.txt +++ b/test/fixtures/go/array-with-implicit-length.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/array-with-implicit-length.diffB-A.txt b/test/fixtures/go/array-with-implicit-length.diffB-A.txt index fe87c3001..ae0923f80 100644 --- a/test/fixtures/go/array-with-implicit-length.diffB-A.txt +++ b/test/fixtures/go/array-with-implicit-length.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/array-with-implicit-length.parseA.txt b/test/fixtures/go/array-with-implicit-length.parseA.txt index 48ff09a57..c023c4b5b 100644 --- a/test/fixtures/go/array-with-implicit-length.parseA.txt +++ b/test/fixtures/go/array-with-implicit-length.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/array-with-implicit-length.parseB.txt b/test/fixtures/go/array-with-implicit-length.parseB.txt index 48ff09a57..c023c4b5b 100644 --- a/test/fixtures/go/array-with-implicit-length.parseB.txt +++ b/test/fixtures/go/array-with-implicit-length.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/assignment-statements.diffA-B.txt b/test/fixtures/go/assignment-statements.diffA-B.txt index 93b76a5d0..7eb02d8f6 100644 --- a/test/fixtures/go/assignment-statements.diffA-B.txt +++ b/test/fixtures/go/assignment-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment { (Identifier) diff --git a/test/fixtures/go/assignment-statements.diffB-A.txt b/test/fixtures/go/assignment-statements.diffB-A.txt index 6258eae0e..6fcdca78e 100644 --- a/test/fixtures/go/assignment-statements.diffB-A.txt +++ b/test/fixtures/go/assignment-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment { (Identifier) diff --git a/test/fixtures/go/assignment-statements.parseA.txt b/test/fixtures/go/assignment-statements.parseA.txt index b495fabbf..acdf77904 100644 --- a/test/fixtures/go/assignment-statements.parseA.txt +++ b/test/fixtures/go/assignment-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/assignment-statements.parseB.txt b/test/fixtures/go/assignment-statements.parseB.txt index b495fabbf..acdf77904 100644 --- a/test/fixtures/go/assignment-statements.parseB.txt +++ b/test/fixtures/go/assignment-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/call-expressions.diffA-B.txt b/test/fixtures/go/call-expressions.diffA-B.txt index 16d749ec1..0e7ef344d 100644 --- a/test/fixtures/go/call-expressions.diffA-B.txt +++ b/test/fixtures/go/call-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call { (Identifier) diff --git a/test/fixtures/go/call-expressions.diffB-A.txt b/test/fixtures/go/call-expressions.diffB-A.txt index 16d749ec1..0e7ef344d 100644 --- a/test/fixtures/go/call-expressions.diffB-A.txt +++ b/test/fixtures/go/call-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call { (Identifier) diff --git a/test/fixtures/go/call-expressions.parseA.txt b/test/fixtures/go/call-expressions.parseA.txt index ec555cda4..cedad1b83 100644 --- a/test/fixtures/go/call-expressions.parseA.txt +++ b/test/fixtures/go/call-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/call-expressions.parseB.txt b/test/fixtures/go/call-expressions.parseB.txt index ec555cda4..cedad1b83 100644 --- a/test/fixtures/go/call-expressions.parseB.txt +++ b/test/fixtures/go/call-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/case-statements.diffA-B.txt b/test/fixtures/go/case-statements.diffA-B.txt index 74670a2a8..efc283ffe 100644 --- a/test/fixtures/go/case-statements.diffA-B.txt +++ b/test/fixtures/go/case-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) { (Match {-(Empty)-} {-([])-}) diff --git a/test/fixtures/go/case-statements.diffB-A.txt b/test/fixtures/go/case-statements.diffB-A.txt index 90cb66111..d4dcb2041 100644 --- a/test/fixtures/go/case-statements.diffB-A.txt +++ b/test/fixtures/go/case-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) { ( {-(Match {-(Pattern diff --git a/test/fixtures/go/case-statements.parseA.txt b/test/fixtures/go/case-statements.parseA.txt index c847c36b2..fc62283dd 100644 --- a/test/fixtures/go/case-statements.parseA.txt +++ b/test/fixtures/go/case-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Match (Empty) ([])))) diff --git a/test/fixtures/go/case-statements.parseB.txt b/test/fixtures/go/case-statements.parseB.txt index c4c4eeb50..8e7578943 100644 --- a/test/fixtures/go/case-statements.parseB.txt +++ b/test/fixtures/go/case-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Match (Pattern diff --git a/test/fixtures/go/channel-types.diffA-B.txt b/test/fixtures/go/channel-types.diffA-B.txt index 7e3332ab9..16a018188 100644 --- a/test/fixtures/go/channel-types.diffA-B.txt +++ b/test/fixtures/go/channel-types.diffA-B.txt @@ -4,12 +4,13 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation { (Identifier) ->(Identifier) } - (SendChannel - (BiDirectionalChannel + (BiDirectionalChannel + (ReceiveChannel { (Identifier) ->(Identifier) }))) (Annotation @@ -24,22 +25,21 @@ {+(SendChannel {+(ReceiveChannel {+(Identifier)+})+})+})+} - {+(Annotation - {+(Identifier)+} - {+(ReceiveChannel + (Annotation + { (Identifier) + ->(Identifier) } + { (SendChannel + {-(ReceiveChannel + {-(Identifier)-})-}) + ->(ReceiveChannel {+(ReceiveChannel - {+(Identifier)+})+})+})+} + {+(Identifier)+})+}) }) {+(Annotation {+(Identifier)+} {+(BiDirectionalChannel {+(ParenthesizedType {+(ReceiveChannel {+(Identifier)+})+})+})+})+} - {-(Annotation - {-(Identifier)-} - {-(SendChannel - {-(ReceiveChannel - {-(Identifier)-})-})-})-} {-(Annotation {-(Identifier)-} {-(ReceiveChannel diff --git a/test/fixtures/go/channel-types.diffB-A.txt b/test/fixtures/go/channel-types.diffB-A.txt index 7e3332ab9..69c30e583 100644 --- a/test/fixtures/go/channel-types.diffB-A.txt +++ b/test/fixtures/go/channel-types.diffB-A.txt @@ -4,12 +4,13 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation { (Identifier) ->(Identifier) } - (SendChannel - (BiDirectionalChannel + (BiDirectionalChannel + (ReceiveChannel { (Identifier) ->(Identifier) }))) (Annotation diff --git a/test/fixtures/go/channel-types.parseA.txt b/test/fixtures/go/channel-types.parseA.txt index 5500eed2c..4ea4d2439 100644 --- a/test/fixtures/go/channel-types.parseA.txt +++ b/test/fixtures/go/channel-types.parseA.txt @@ -4,11 +4,12 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) - (SendChannel - (BiDirectionalChannel + (BiDirectionalChannel + (ReceiveChannel (Identifier)))) (Annotation (Identifier) diff --git a/test/fixtures/go/channel-types.parseB.txt b/test/fixtures/go/channel-types.parseB.txt index 5500eed2c..4ea4d2439 100644 --- a/test/fixtures/go/channel-types.parseB.txt +++ b/test/fixtures/go/channel-types.parseB.txt @@ -4,11 +4,12 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) - (SendChannel - (BiDirectionalChannel + (BiDirectionalChannel + (ReceiveChannel (Identifier)))) (Annotation (Identifier) diff --git a/test/fixtures/go/comment.diffA-B.txt b/test/fixtures/go/comment.diffA-B.txt index 099b3b49f..b6048f526 100644 --- a/test/fixtures/go/comment.diffA-B.txt +++ b/test/fixtures/go/comment.diffA-B.txt @@ -4,5 +4,6 @@ (Function (Empty) (Identifier) + ([]) { (Comment) ->(Comment) })) diff --git a/test/fixtures/go/comment.diffB-A.txt b/test/fixtures/go/comment.diffB-A.txt index 099b3b49f..b6048f526 100644 --- a/test/fixtures/go/comment.diffB-A.txt +++ b/test/fixtures/go/comment.diffB-A.txt @@ -4,5 +4,6 @@ (Function (Empty) (Identifier) + ([]) { (Comment) ->(Comment) })) diff --git a/test/fixtures/go/comment.parseA.txt b/test/fixtures/go/comment.parseA.txt index be50dd587..a8bf8b6fb 100644 --- a/test/fixtures/go/comment.parseA.txt +++ b/test/fixtures/go/comment.parseA.txt @@ -4,4 +4,5 @@ (Function (Empty) (Identifier) + ([]) (Comment))) diff --git a/test/fixtures/go/comment.parseB.txt b/test/fixtures/go/comment.parseB.txt index be50dd587..a8bf8b6fb 100644 --- a/test/fixtures/go/comment.parseB.txt +++ b/test/fixtures/go/comment.parseB.txt @@ -4,4 +4,5 @@ (Function (Empty) (Identifier) + ([]) (Comment))) diff --git a/test/fixtures/go/const-declarations-with-types.diffA-B.txt b/test/fixtures/go/const-declarations-with-types.diffA-B.txt index ca804897a..4c3291351 100644 --- a/test/fixtures/go/const-declarations-with-types.diffA-B.txt +++ b/test/fixtures/go/const-declarations-with-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Annotation ( diff --git a/test/fixtures/go/const-declarations-with-types.diffB-A.txt b/test/fixtures/go/const-declarations-with-types.diffB-A.txt index 53f20f9bb..1dfcb390c 100644 --- a/test/fixtures/go/const-declarations-with-types.diffB-A.txt +++ b/test/fixtures/go/const-declarations-with-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Annotation ( diff --git a/test/fixtures/go/const-declarations-with-types.parseA.txt b/test/fixtures/go/const-declarations-with-types.parseA.txt index 302b425b6..195fdb99a 100644 --- a/test/fixtures/go/const-declarations-with-types.parseA.txt +++ b/test/fixtures/go/const-declarations-with-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Annotation ( diff --git a/test/fixtures/go/const-declarations-with-types.parseB.txt b/test/fixtures/go/const-declarations-with-types.parseB.txt index 89b145013..d6a610b6a 100644 --- a/test/fixtures/go/const-declarations-with-types.parseB.txt +++ b/test/fixtures/go/const-declarations-with-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Annotation ( diff --git a/test/fixtures/go/const-declarations-without-types.diffA-B.txt b/test/fixtures/go/const-declarations-without-types.diffA-B.txt index 804caeb9b..f04f21606 100644 --- a/test/fixtures/go/const-declarations-without-types.diffA-B.txt +++ b/test/fixtures/go/const-declarations-without-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment { (Identifier) ->( diff --git a/test/fixtures/go/const-declarations-without-types.diffB-A.txt b/test/fixtures/go/const-declarations-without-types.diffB-A.txt index 7796835c1..c6c0d76a2 100644 --- a/test/fixtures/go/const-declarations-without-types.diffB-A.txt +++ b/test/fixtures/go/const-declarations-without-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment { ( {-(Identifier)-} diff --git a/test/fixtures/go/const-declarations-without-types.parseA.txt b/test/fixtures/go/const-declarations-without-types.parseA.txt index a2d50974f..0e708ae6a 100644 --- a/test/fixtures/go/const-declarations-without-types.parseA.txt +++ b/test/fixtures/go/const-declarations-without-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Integer)))) diff --git a/test/fixtures/go/const-declarations-without-types.parseB.txt b/test/fixtures/go/const-declarations-without-types.parseB.txt index bfcfcf674..a9818a78a 100644 --- a/test/fixtures/go/const-declarations-without-types.parseB.txt +++ b/test/fixtures/go/const-declarations-without-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment ( (Identifier) diff --git a/test/fixtures/go/const-with-implicit-values.diffA-B.txt b/test/fixtures/go/const-with-implicit-values.diffA-B.txt index 7207d5dff..dff4e5266 100644 --- a/test/fixtures/go/const-with-implicit-values.diffA-B.txt +++ b/test/fixtures/go/const-with-implicit-values.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment { (Identifier) diff --git a/test/fixtures/go/const-with-implicit-values.diffB-A.txt b/test/fixtures/go/const-with-implicit-values.diffB-A.txt index 7207d5dff..dff4e5266 100644 --- a/test/fixtures/go/const-with-implicit-values.diffB-A.txt +++ b/test/fixtures/go/const-with-implicit-values.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment { (Identifier) diff --git a/test/fixtures/go/const-with-implicit-values.parseA.txt b/test/fixtures/go/const-with-implicit-values.parseA.txt index 5adf0aade..4d208ed0f 100644 --- a/test/fixtures/go/const-with-implicit-values.parseA.txt +++ b/test/fixtures/go/const-with-implicit-values.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/const-with-implicit-values.parseB.txt b/test/fixtures/go/const-with-implicit-values.parseB.txt index 5adf0aade..4d208ed0f 100644 --- a/test/fixtures/go/const-with-implicit-values.parseB.txt +++ b/test/fixtures/go/const-with-implicit-values.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/constructors.diffA-B.txt b/test/fixtures/go/constructors.diffA-B.txt index 0a653c743..030a64b70 100644 --- a/test/fixtures/go/constructors.diffA-B.txt +++ b/test/fixtures/go/constructors.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/constructors.diffB-A.txt b/test/fixtures/go/constructors.diffB-A.txt index 0a653c743..030a64b70 100644 --- a/test/fixtures/go/constructors.diffB-A.txt +++ b/test/fixtures/go/constructors.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/constructors.parseA.txt b/test/fixtures/go/constructors.parseA.txt index 53e03f22b..3debd8601 100644 --- a/test/fixtures/go/constructors.parseA.txt +++ b/test/fixtures/go/constructors.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/constructors.parseB.txt b/test/fixtures/go/constructors.parseB.txt index 53e03f22b..3debd8601 100644 --- a/test/fixtures/go/constructors.parseB.txt +++ b/test/fixtures/go/constructors.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/float-literals.diffA-B.txt b/test/fixtures/go/float-literals.diffA-B.txt index 015590ac9..724270545 100644 --- a/test/fixtures/go/float-literals.diffA-B.txt +++ b/test/fixtures/go/float-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/float-literals.diffB-A.txt b/test/fixtures/go/float-literals.diffB-A.txt index 015590ac9..724270545 100644 --- a/test/fixtures/go/float-literals.diffB-A.txt +++ b/test/fixtures/go/float-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/float-literals.parseA.txt b/test/fixtures/go/float-literals.parseA.txt index aa654d8a4..0933195ec 100644 --- a/test/fixtures/go/float-literals.parseA.txt +++ b/test/fixtures/go/float-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/float-literals.parseB.txt b/test/fixtures/go/float-literals.parseB.txt index aa654d8a4..0933195ec 100644 --- a/test/fixtures/go/float-literals.parseB.txt +++ b/test/fixtures/go/float-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/for-statements.diffA-B.txt b/test/fixtures/go/for-statements.diffA-B.txt index 0c2cb3bfb..f7aca0464 100644 --- a/test/fixtures/go/for-statements.diffA-B.txt +++ b/test/fixtures/go/for-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (For (Empty) diff --git a/test/fixtures/go/for-statements.diffB-A.txt b/test/fixtures/go/for-statements.diffB-A.txt index 93d80b429..189b53965 100644 --- a/test/fixtures/go/for-statements.diffB-A.txt +++ b/test/fixtures/go/for-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (For (Empty) diff --git a/test/fixtures/go/for-statements.parseA.txt b/test/fixtures/go/for-statements.parseA.txt index dacb795c9..2a2fb153e 100644 --- a/test/fixtures/go/for-statements.parseA.txt +++ b/test/fixtures/go/for-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (For (Empty) diff --git a/test/fixtures/go/for-statements.parseB.txt b/test/fixtures/go/for-statements.parseB.txt index af680b601..1e22d434d 100644 --- a/test/fixtures/go/for-statements.parseB.txt +++ b/test/fixtures/go/for-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (For (Empty) diff --git a/test/fixtures/go/function-declarations.diffA-B.txt b/test/fixtures/go/function-declarations.diffA-B.txt index 802086fae..f249cd811 100644 --- a/test/fixtures/go/function-declarations.diffA-B.txt +++ b/test/fixtures/go/function-declarations.diffA-B.txt @@ -4,33 +4,42 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) { (Identifier) ->(Identifier) } + ([]) ([])) (Function (Identifier) { (Identifier) ->(Identifier) } ( + ( + (Identifier) + (Identifier)) (Identifier) - (Identifier)) - (Identifier) - (Identifier) - ( (Identifier) - (Identifier)) + ( + (Identifier) + (Identifier))) ([])) (Function - ( - (Identifier) - (Identifier)) + (Empty) { (Identifier) ->(Identifier) } + ([]) + ( + (Identifier) + (Identifier)) ([])) (Function + (Empty) + { (Identifier) + ->(Identifier) } + ([]) ( ( (Identifier) @@ -38,11 +47,11 @@ ( (Identifier) (Identifier))) - { (Identifier) - ->(Identifier) } ([])) {+(Function - {+([])+} + {+(Empty)+} {+(Identifier)+} + {+([])+} + {+([])+} {+(NoOp {+(Empty)+})+})+}) diff --git a/test/fixtures/go/function-declarations.diffB-A.txt b/test/fixtures/go/function-declarations.diffB-A.txt index 227c603f7..f918cd8e4 100644 --- a/test/fixtures/go/function-declarations.diffB-A.txt +++ b/test/fixtures/go/function-declarations.diffB-A.txt @@ -4,33 +4,42 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) { (Identifier) ->(Identifier) } + ([]) ([])) (Function (Identifier) { (Identifier) ->(Identifier) } ( + ( + (Identifier) + (Identifier)) (Identifier) - (Identifier)) - (Identifier) - (Identifier) - ( (Identifier) - (Identifier)) + ( + (Identifier) + (Identifier))) ([])) (Function - ( - (Identifier) - (Identifier)) + (Empty) { (Identifier) ->(Identifier) } + ([]) + ( + (Identifier) + (Identifier)) ([])) (Function + (Empty) + { (Identifier) + ->(Identifier) } + ([]) ( ( (Identifier) @@ -38,11 +47,11 @@ ( (Identifier) (Identifier))) - { (Identifier) - ->(Identifier) } ([])) {-(Function - {-([])-} + {-(Empty)-} {-(Identifier)-} + {-([])-} + {-([])-} {-(NoOp {-(Empty)-})-})-}) diff --git a/test/fixtures/go/function-declarations.parseA.txt b/test/fixtures/go/function-declarations.parseA.txt index cd1a10acb..8a0c2abfd 100644 --- a/test/fixtures/go/function-declarations.parseA.txt +++ b/test/fixtures/go/function-declarations.parseA.txt @@ -4,30 +4,38 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) + ([]) ([])) (Function (Identifier) (Identifier) ( + ( + (Identifier) + (Identifier)) (Identifier) - (Identifier)) - (Identifier) + (Identifier) + ( + (Identifier) + (Identifier))) + ([])) + (Function + (Empty) (Identifier) + ([]) ( (Identifier) (Identifier)) ([])) (Function - ( - (Identifier) - (Identifier)) + (Empty) (Identifier) - ([])) - (Function + ([]) ( ( (Identifier) @@ -35,5 +43,4 @@ ( (Identifier) (Identifier))) - (Identifier) ([]))) diff --git a/test/fixtures/go/function-declarations.parseB.txt b/test/fixtures/go/function-declarations.parseB.txt index 15c971852..56a00305e 100644 --- a/test/fixtures/go/function-declarations.parseB.txt +++ b/test/fixtures/go/function-declarations.parseB.txt @@ -4,30 +4,38 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) + ([]) ([])) (Function (Identifier) (Identifier) ( + ( + (Identifier) + (Identifier)) (Identifier) - (Identifier)) - (Identifier) + (Identifier) + ( + (Identifier) + (Identifier))) + ([])) + (Function + (Empty) (Identifier) + ([]) ( (Identifier) (Identifier)) ([])) (Function - ( - (Identifier) - (Identifier)) + (Empty) (Identifier) - ([])) - (Function + ([]) ( ( (Identifier) @@ -35,10 +43,11 @@ ( (Identifier) (Identifier))) - (Identifier) ([])) (Function - ([]) + (Empty) (Identifier) + ([]) + ([]) (NoOp (Empty)))) diff --git a/test/fixtures/go/function-literals.diffA-B.txt b/test/fixtures/go/function-literals.diffA-B.txt index 621956de7..2771edf1c 100644 --- a/test/fixtures/go/function-literals.diffA-B.txt +++ b/test/fixtures/go/function-literals.diffA-B.txt @@ -4,15 +4,18 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Function - ( - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) (Empty) + (Empty) + ( + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) ( { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/function-literals.diffB-A.txt b/test/fixtures/go/function-literals.diffB-A.txt index 621956de7..2771edf1c 100644 --- a/test/fixtures/go/function-literals.diffB-A.txt +++ b/test/fixtures/go/function-literals.diffB-A.txt @@ -4,15 +4,18 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Function - ( - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) (Empty) + (Empty) + ( + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) ( { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/function-literals.parseA.txt b/test/fixtures/go/function-literals.parseA.txt index 5c548793c..e6b891cce 100644 --- a/test/fixtures/go/function-literals.parseA.txt +++ b/test/fixtures/go/function-literals.parseA.txt @@ -4,13 +4,16 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Function - ( - (Identifier) - (Identifier)) (Empty) + (Empty) + ( + ( + (Identifier) + (Identifier))) ( (Identifier) (Identifier)) diff --git a/test/fixtures/go/function-literals.parseB.txt b/test/fixtures/go/function-literals.parseB.txt index 5c548793c..e6b891cce 100644 --- a/test/fixtures/go/function-literals.parseB.txt +++ b/test/fixtures/go/function-literals.parseB.txt @@ -4,13 +4,16 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Function - ( - (Identifier) - (Identifier)) (Empty) + (Empty) + ( + ( + (Identifier) + (Identifier))) ( (Identifier) (Identifier)) diff --git a/test/fixtures/go/function-types.diffA-B.txt b/test/fixtures/go/function-types.diffA-B.txt index cebfd4059..9d5f1752f 100644 --- a/test/fixtures/go/function-types.diffA-B.txt +++ b/test/fixtures/go/function-types.diffA-B.txt @@ -4,24 +4,29 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation { (Identifier) ->(Identifier) } (Function - { (Identifier) - ->(Identifier) } + ( + { (Identifier) + ->(Identifier) }) { (Identifier) ->(Identifier) })) (Annotation { (Identifier) ->(Identifier) } (Function - {-(Identifier)-} - (Identifier) - {+(Identifier)+} ( - {+(BiDirectionalChannel - {+(Identifier)+})+} {-(Identifier)-} - (Identifier))))))) + (Identifier) + {+(Identifier)+}) + ( + {+( + {+(BiDirectionalChannel + {+(Identifier)+})+})+} + {-(Identifier)-} + (Identifier)) + (Empty)))))) diff --git a/test/fixtures/go/function-types.diffB-A.txt b/test/fixtures/go/function-types.diffB-A.txt index bcb2228cc..5b327109a 100644 --- a/test/fixtures/go/function-types.diffB-A.txt +++ b/test/fixtures/go/function-types.diffB-A.txt @@ -4,24 +4,29 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation { (Identifier) ->(Identifier) } (Function - { (Identifier) - ->(Identifier) } + ( + { (Identifier) + ->(Identifier) }) { (Identifier) ->(Identifier) })) (Annotation { (Identifier) ->(Identifier) } (Function - {-(Identifier)-} - (Identifier) - {+(Identifier)+} + ( + {-(Identifier)-} + (Identifier) + {+(Identifier)+}) ( {+(Identifier)+} - {-(BiDirectionalChannel - {-(Identifier)-})-} - (Identifier))))))) + {-( + {-(BiDirectionalChannel + {-(Identifier)-})-})-} + (Identifier)) + (Empty)))))) diff --git a/test/fixtures/go/function-types.parseA.txt b/test/fixtures/go/function-types.parseA.txt index c467cb392..84fb54bc6 100644 --- a/test/fixtures/go/function-types.parseA.txt +++ b/test/fixtures/go/function-types.parseA.txt @@ -4,17 +4,21 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) (Function - (Identifier) + ( + (Identifier)) (Identifier))) (Annotation (Identifier) (Function - (Identifier) - (Identifier) ( (Identifier) - (Identifier))))))) + (Identifier)) + ( + (Identifier) + (Identifier)) + (Empty)))))) diff --git a/test/fixtures/go/function-types.parseB.txt b/test/fixtures/go/function-types.parseB.txt index a1a18c8ba..92c76fedc 100644 --- a/test/fixtures/go/function-types.parseB.txt +++ b/test/fixtures/go/function-types.parseB.txt @@ -4,18 +4,23 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) (Function - (Identifier) + ( + (Identifier)) (Identifier))) (Annotation (Identifier) (Function - (Identifier) - (Identifier) ( - (BiDirectionalChannel - (Identifier)) - (Identifier))))))) + (Identifier) + (Identifier)) + ( + ( + (BiDirectionalChannel + (Identifier))) + (Identifier)) + (Empty)))))) diff --git a/test/fixtures/go/go-and-defer-statements.diffA-B.txt b/test/fixtures/go/go-and-defer-statements.diffA-B.txt index 3d3b7e2b5..a1ad72292 100644 --- a/test/fixtures/go/go-and-defer-statements.diffA-B.txt +++ b/test/fixtures/go/go-and-defer-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Defer (Call diff --git a/test/fixtures/go/go-and-defer-statements.diffB-A.txt b/test/fixtures/go/go-and-defer-statements.diffB-A.txt index 3d3b7e2b5..a1ad72292 100644 --- a/test/fixtures/go/go-and-defer-statements.diffB-A.txt +++ b/test/fixtures/go/go-and-defer-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Defer (Call diff --git a/test/fixtures/go/go-and-defer-statements.parseA.txt b/test/fixtures/go/go-and-defer-statements.parseA.txt index b1ad7a81a..e8b59defc 100644 --- a/test/fixtures/go/go-and-defer-statements.parseA.txt +++ b/test/fixtures/go/go-and-defer-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Defer (Call diff --git a/test/fixtures/go/go-and-defer-statements.parseB.txt b/test/fixtures/go/go-and-defer-statements.parseB.txt index b1ad7a81a..e8b59defc 100644 --- a/test/fixtures/go/go-and-defer-statements.parseB.txt +++ b/test/fixtures/go/go-and-defer-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Defer (Call diff --git a/test/fixtures/go/grouped-import-declarations.diffA-B.txt b/test/fixtures/go/grouped-import-declarations.diffA-B.txt index 0c3d5f8a3..ffa6735b1 100644 --- a/test/fixtures/go/grouped-import-declarations.diffA-B.txt +++ b/test/fixtures/go/grouped-import-declarations.diffA-B.txt @@ -13,4 +13,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/grouped-import-declarations.diffB-A.txt b/test/fixtures/go/grouped-import-declarations.diffB-A.txt index 0c3d5f8a3..ffa6735b1 100644 --- a/test/fixtures/go/grouped-import-declarations.diffB-A.txt +++ b/test/fixtures/go/grouped-import-declarations.diffB-A.txt @@ -13,4 +13,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/grouped-import-declarations.parseA.txt b/test/fixtures/go/grouped-import-declarations.parseA.txt index 17726f254..d2afa1626 100644 --- a/test/fixtures/go/grouped-import-declarations.parseA.txt +++ b/test/fixtures/go/grouped-import-declarations.parseA.txt @@ -10,4 +10,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/grouped-import-declarations.parseB.txt b/test/fixtures/go/grouped-import-declarations.parseB.txt index 17726f254..d2afa1626 100644 --- a/test/fixtures/go/grouped-import-declarations.parseB.txt +++ b/test/fixtures/go/grouped-import-declarations.parseB.txt @@ -10,4 +10,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/grouped-var-declarations.diffA-B.txt b/test/fixtures/go/grouped-var-declarations.diffA-B.txt index 7e4dacc9f..d9ecbd215 100644 --- a/test/fixtures/go/grouped-var-declarations.diffA-B.txt +++ b/test/fixtures/go/grouped-var-declarations.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment { (Identifier) diff --git a/test/fixtures/go/grouped-var-declarations.diffB-A.txt b/test/fixtures/go/grouped-var-declarations.diffB-A.txt index 7e4dacc9f..d9ecbd215 100644 --- a/test/fixtures/go/grouped-var-declarations.diffB-A.txt +++ b/test/fixtures/go/grouped-var-declarations.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment { (Identifier) diff --git a/test/fixtures/go/grouped-var-declarations.parseA.txt b/test/fixtures/go/grouped-var-declarations.parseA.txt index 499d9392e..7524892c3 100644 --- a/test/fixtures/go/grouped-var-declarations.parseA.txt +++ b/test/fixtures/go/grouped-var-declarations.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/grouped-var-declarations.parseB.txt b/test/fixtures/go/grouped-var-declarations.parseB.txt index 499d9392e..7524892c3 100644 --- a/test/fixtures/go/grouped-var-declarations.parseB.txt +++ b/test/fixtures/go/grouped-var-declarations.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/if-statements.diffA-B.txt b/test/fixtures/go/if-statements.diffA-B.txt index 56c2a1b75..6e2757403 100644 --- a/test/fixtures/go/if-statements.diffA-B.txt +++ b/test/fixtures/go/if-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (If ( diff --git a/test/fixtures/go/if-statements.diffB-A.txt b/test/fixtures/go/if-statements.diffB-A.txt index 56c2a1b75..6e2757403 100644 --- a/test/fixtures/go/if-statements.diffB-A.txt +++ b/test/fixtures/go/if-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (If ( diff --git a/test/fixtures/go/if-statements.parseA.txt b/test/fixtures/go/if-statements.parseA.txt index 5c54cbfcc..3e08a5367 100644 --- a/test/fixtures/go/if-statements.parseA.txt +++ b/test/fixtures/go/if-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (If ( diff --git a/test/fixtures/go/if-statements.parseB.txt b/test/fixtures/go/if-statements.parseB.txt index 5c54cbfcc..3e08a5367 100644 --- a/test/fixtures/go/if-statements.parseB.txt +++ b/test/fixtures/go/if-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (If ( diff --git a/test/fixtures/go/imaginary-literals.diffA-B.txt b/test/fixtures/go/imaginary-literals.diffA-B.txt index 0955b26ce..b0b508043 100644 --- a/test/fixtures/go/imaginary-literals.diffA-B.txt +++ b/test/fixtures/go/imaginary-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/imaginary-literals.diffB-A.txt b/test/fixtures/go/imaginary-literals.diffB-A.txt index 0955b26ce..b0b508043 100644 --- a/test/fixtures/go/imaginary-literals.diffB-A.txt +++ b/test/fixtures/go/imaginary-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/imaginary-literals.parseA.txt b/test/fixtures/go/imaginary-literals.parseA.txt index 994f26f14..1a45a76fb 100644 --- a/test/fixtures/go/imaginary-literals.parseA.txt +++ b/test/fixtures/go/imaginary-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/imaginary-literals.parseB.txt b/test/fixtures/go/imaginary-literals.parseB.txt index 994f26f14..1a45a76fb 100644 --- a/test/fixtures/go/imaginary-literals.parseB.txt +++ b/test/fixtures/go/imaginary-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/increment-decrement-statements.diffA-B.txt b/test/fixtures/go/increment-decrement-statements.diffA-B.txt index 31b6de303..eb6b71b86 100644 --- a/test/fixtures/go/increment-decrement-statements.diffA-B.txt +++ b/test/fixtures/go/increment-decrement-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (PostIncrement { (Identifier) diff --git a/test/fixtures/go/increment-decrement-statements.diffB-A.txt b/test/fixtures/go/increment-decrement-statements.diffB-A.txt index d2ba2f5dc..50ceec862 100644 --- a/test/fixtures/go/increment-decrement-statements.diffB-A.txt +++ b/test/fixtures/go/increment-decrement-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (PostIncrement { (Identifier) diff --git a/test/fixtures/go/increment-decrement-statements.parseA.txt b/test/fixtures/go/increment-decrement-statements.parseA.txt index 466d97a40..62f4d94b5 100644 --- a/test/fixtures/go/increment-decrement-statements.parseA.txt +++ b/test/fixtures/go/increment-decrement-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (PostIncrement (Identifier)) diff --git a/test/fixtures/go/increment-decrement-statements.parseB.txt b/test/fixtures/go/increment-decrement-statements.parseB.txt index d41ba4f7b..76266bd84 100644 --- a/test/fixtures/go/increment-decrement-statements.parseB.txt +++ b/test/fixtures/go/increment-decrement-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (PostIncrement (Identifier)) diff --git a/test/fixtures/go/indexing-expressions.diffA-B.txt b/test/fixtures/go/indexing-expressions.diffA-B.txt index 7222118d1..5d10cfbab 100644 --- a/test/fixtures/go/indexing-expressions.diffA-B.txt +++ b/test/fixtures/go/indexing-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( {+(Slice {+(Identifier)+} diff --git a/test/fixtures/go/indexing-expressions.diffB-A.txt b/test/fixtures/go/indexing-expressions.diffB-A.txt index 9595f2f64..7fc0278c4 100644 --- a/test/fixtures/go/indexing-expressions.diffB-A.txt +++ b/test/fixtures/go/indexing-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( {+(Subscript {+(Identifier)+} diff --git a/test/fixtures/go/indexing-expressions.parseA.txt b/test/fixtures/go/indexing-expressions.parseA.txt index dc299a6c0..5f9184e3d 100644 --- a/test/fixtures/go/indexing-expressions.parseA.txt +++ b/test/fixtures/go/indexing-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Subscript (Identifier) diff --git a/test/fixtures/go/indexing-expressions.parseB.txt b/test/fixtures/go/indexing-expressions.parseB.txt index 213c514b6..e44e2ccf4 100644 --- a/test/fixtures/go/indexing-expressions.parseB.txt +++ b/test/fixtures/go/indexing-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Slice (Identifier) diff --git a/test/fixtures/go/int-literals.diffA-B.txt b/test/fixtures/go/int-literals.diffA-B.txt index 9be0c4c0a..92b61c039 100644 --- a/test/fixtures/go/int-literals.diffA-B.txt +++ b/test/fixtures/go/int-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/int-literals.diffB-A.txt b/test/fixtures/go/int-literals.diffB-A.txt index 9be0c4c0a..92b61c039 100644 --- a/test/fixtures/go/int-literals.diffB-A.txt +++ b/test/fixtures/go/int-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/int-literals.parseA.txt b/test/fixtures/go/int-literals.parseA.txt index 9341f02cf..e46b95e67 100644 --- a/test/fixtures/go/int-literals.parseA.txt +++ b/test/fixtures/go/int-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/int-literals.parseB.txt b/test/fixtures/go/int-literals.parseB.txt index 9341f02cf..e46b95e67 100644 --- a/test/fixtures/go/int-literals.parseB.txt +++ b/test/fixtures/go/int-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/interface-types.diffA-B.txt b/test/fixtures/go/interface-types.diffA-B.txt index b62dd2fa8..cd0b35eb2 100644 --- a/test/fixtures/go/interface-types.diffA-B.txt +++ b/test/fixtures/go/interface-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/interface-types.diffB-A.txt b/test/fixtures/go/interface-types.diffB-A.txt index b62dd2fa8..cd0b35eb2 100644 --- a/test/fixtures/go/interface-types.diffB-A.txt +++ b/test/fixtures/go/interface-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/interface-types.parseA.txt b/test/fixtures/go/interface-types.parseA.txt index 196a1faad..a6ecfe5ee 100644 --- a/test/fixtures/go/interface-types.parseA.txt +++ b/test/fixtures/go/interface-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/interface-types.parseB.txt b/test/fixtures/go/interface-types.parseB.txt index 196a1faad..a6ecfe5ee 100644 --- a/test/fixtures/go/interface-types.parseB.txt +++ b/test/fixtures/go/interface-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/label-statements.diffA-B.txt b/test/fixtures/go/label-statements.diffA-B.txt index 5138230cd..66b1fd6fe 100644 --- a/test/fixtures/go/label-statements.diffA-B.txt +++ b/test/fixtures/go/label-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Label { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/label-statements.diffB-A.txt b/test/fixtures/go/label-statements.diffB-A.txt index 5138230cd..66b1fd6fe 100644 --- a/test/fixtures/go/label-statements.diffB-A.txt +++ b/test/fixtures/go/label-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Label { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/label-statements.parseA.txt b/test/fixtures/go/label-statements.parseA.txt index d802b6743..f95fe5266 100644 --- a/test/fixtures/go/label-statements.parseA.txt +++ b/test/fixtures/go/label-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Label (Identifier) (Empty)))) diff --git a/test/fixtures/go/label-statements.parseB.txt b/test/fixtures/go/label-statements.parseB.txt index d802b6743..f95fe5266 100644 --- a/test/fixtures/go/label-statements.parseB.txt +++ b/test/fixtures/go/label-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Label (Identifier) (Empty)))) diff --git a/test/fixtures/go/map-literals.diffA-B.txt b/test/fixtures/go/map-literals.diffA-B.txt index 1d79927ab..1e2881663 100644 --- a/test/fixtures/go/map-literals.diffA-B.txt +++ b/test/fixtures/go/map-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/map-literals.diffB-A.txt b/test/fixtures/go/map-literals.diffB-A.txt index 1d79927ab..1e2881663 100644 --- a/test/fixtures/go/map-literals.diffB-A.txt +++ b/test/fixtures/go/map-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/map-literals.parseA.txt b/test/fixtures/go/map-literals.parseA.txt index db74831d5..4f4d2ac0f 100644 --- a/test/fixtures/go/map-literals.parseA.txt +++ b/test/fixtures/go/map-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/map-literals.parseB.txt b/test/fixtures/go/map-literals.parseB.txt index db74831d5..4f4d2ac0f 100644 --- a/test/fixtures/go/map-literals.parseB.txt +++ b/test/fixtures/go/map-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Composite diff --git a/test/fixtures/go/map-types.diffA-B.txt b/test/fixtures/go/map-types.diffA-B.txt index ebf22eaf5..1da06e43b 100644 --- a/test/fixtures/go/map-types.diffA-B.txt +++ b/test/fixtures/go/map-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/map-types.diffB-A.txt b/test/fixtures/go/map-types.diffB-A.txt index ebf22eaf5..1da06e43b 100644 --- a/test/fixtures/go/map-types.diffB-A.txt +++ b/test/fixtures/go/map-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/map-types.parseA.txt b/test/fixtures/go/map-types.parseA.txt index 52d5c4a4c..a083ad4e7 100644 --- a/test/fixtures/go/map-types.parseA.txt +++ b/test/fixtures/go/map-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/map-types.parseB.txt b/test/fixtures/go/map-types.parseB.txt index 52d5c4a4c..a083ad4e7 100644 --- a/test/fixtures/go/map-types.parseB.txt +++ b/test/fixtures/go/map-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/method-declarations.diffA-B.txt b/test/fixtures/go/method-declarations.diffA-B.txt index 1886dc33e..cf8b0c348 100644 --- a/test/fixtures/go/method-declarations.diffA-B.txt +++ b/test/fixtures/go/method-declarations.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ([])) (Method (Identifier) @@ -12,9 +13,11 @@ { (Identifier) ->(Identifier) }) (Identifier) - (Identifier) - { (Identifier) - ->(Identifier) } + ( + ( + (Identifier) + { (Identifier) + ->(Identifier) })) ([])) (Method (Identifier) @@ -24,6 +27,7 @@ (Identifier))) { (Identifier) ->(Identifier) } + ([]) (Return (Call (MemberAccess @@ -79,9 +83,11 @@ (Pointer (Identifier))) (Identifier) - (Identifier) - { (Identifier) - ->(Identifier) } + ( + ( + (Identifier) + { (Identifier) + ->(Identifier) })) ( (Assignment (MemberAccess @@ -108,10 +114,11 @@ (Pointer (Identifier))) (Identifier) - { (Identifier) - ->(Identifier) } ( { (Identifier) ->(Identifier) } - (Identifier)) + ( + { (Identifier) + ->(Identifier) } + (Identifier))) ([]))) diff --git a/test/fixtures/go/method-declarations.diffB-A.txt b/test/fixtures/go/method-declarations.diffB-A.txt index 77dcd4192..88a702429 100644 --- a/test/fixtures/go/method-declarations.diffB-A.txt +++ b/test/fixtures/go/method-declarations.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ([])) (Method (Identifier) @@ -12,9 +13,11 @@ { (Identifier) ->(Identifier) }) (Identifier) - (Identifier) - { (Identifier) - ->(Identifier) } + ( + ( + (Identifier) + { (Identifier) + ->(Identifier) })) ([])) (Method (Identifier) @@ -24,6 +27,7 @@ (Identifier))) { (Identifier) ->(Identifier) } + ([]) (Return (Call (MemberAccess @@ -79,9 +83,11 @@ (Pointer (Identifier))) (Identifier) - (Identifier) - { (Identifier) - ->(Identifier) } + ( + ( + (Identifier) + { (Identifier) + ->(Identifier) })) ( (Assignment (MemberAccess @@ -108,10 +114,11 @@ (Pointer (Identifier))) (Identifier) - { (Identifier) - ->(Identifier) } ( { (Identifier) ->(Identifier) } - (Identifier)) + ( + { (Identifier) + ->(Identifier) } + (Identifier))) ([]))) diff --git a/test/fixtures/go/method-declarations.parseA.txt b/test/fixtures/go/method-declarations.parseA.txt index fb698d9fa..e69e33acd 100644 --- a/test/fixtures/go/method-declarations.parseA.txt +++ b/test/fixtures/go/method-declarations.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ([])) (Method (Identifier) @@ -11,8 +12,10 @@ (Identifier) (Identifier)) (Identifier) - (Identifier) - (Identifier) + ( + ( + (Identifier) + (Identifier))) ([])) (Method (Identifier) @@ -21,6 +24,7 @@ (Pointer (Identifier))) (Identifier) + ([]) (Return (Call (MemberAccess @@ -49,8 +53,10 @@ (Pointer (Identifier))) (Identifier) - (Identifier) - (Identifier) + ( + ( + (Identifier) + (Identifier))) ( (Assignment (MemberAccess @@ -77,8 +83,9 @@ (Pointer (Identifier))) (Identifier) - (Identifier) ( (Identifier) - (Identifier)) + ( + (Identifier) + (Identifier))) ([]))) diff --git a/test/fixtures/go/method-declarations.parseB.txt b/test/fixtures/go/method-declarations.parseB.txt index b3056cf0d..8204c9023 100644 --- a/test/fixtures/go/method-declarations.parseB.txt +++ b/test/fixtures/go/method-declarations.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ([])) (Method (Identifier) @@ -11,8 +12,10 @@ (Identifier) (Identifier)) (Identifier) - (Identifier) - (Identifier) + ( + ( + (Identifier) + (Identifier))) ([])) (Method (Identifier) @@ -21,6 +24,7 @@ (Pointer (Identifier))) (Identifier) + ([]) (Return (Call (MemberAccess @@ -61,8 +65,10 @@ (Pointer (Identifier))) (Identifier) - (Identifier) - (Identifier) + ( + ( + (Identifier) + (Identifier))) ( (Assignment (MemberAccess @@ -89,8 +95,9 @@ (Pointer (Identifier))) (Identifier) - (Identifier) ( (Identifier) - (Identifier)) + ( + (Identifier) + (Identifier))) ([]))) diff --git a/test/fixtures/go/modifying-struct-fields.diffA-B.txt b/test/fixtures/go/modifying-struct-fields.diffA-B.txt index 9d1912f5c..0e301df4e 100644 --- a/test/fixtures/go/modifying-struct-fields.diffA-B.txt +++ b/test/fixtures/go/modifying-struct-fields.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Reference diff --git a/test/fixtures/go/modifying-struct-fields.diffB-A.txt b/test/fixtures/go/modifying-struct-fields.diffB-A.txt index 1cf3407af..30800bde9 100644 --- a/test/fixtures/go/modifying-struct-fields.diffB-A.txt +++ b/test/fixtures/go/modifying-struct-fields.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Reference diff --git a/test/fixtures/go/modifying-struct-fields.parseA.txt b/test/fixtures/go/modifying-struct-fields.parseA.txt index 33337fbe0..687e7ac57 100644 --- a/test/fixtures/go/modifying-struct-fields.parseA.txt +++ b/test/fixtures/go/modifying-struct-fields.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Reference diff --git a/test/fixtures/go/modifying-struct-fields.parseB.txt b/test/fixtures/go/modifying-struct-fields.parseB.txt index 8e11371ed..3dacd1685 100644 --- a/test/fixtures/go/modifying-struct-fields.parseB.txt +++ b/test/fixtures/go/modifying-struct-fields.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Reference diff --git a/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt b/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt index 78d829d41..43130d815 100644 --- a/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt +++ b/test/fixtures/go/parameter-declarations-with-types.diffA-B.txt @@ -4,18 +4,20 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) ( - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - ( - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) ([]))) diff --git a/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt b/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt index 78d829d41..43130d815 100644 --- a/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt +++ b/test/fixtures/go/parameter-declarations-with-types.diffB-A.txt @@ -4,18 +4,20 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) ( - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - ( - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) })) ([]))) diff --git a/test/fixtures/go/parameter-declarations-with-types.parseA.txt b/test/fixtures/go/parameter-declarations-with-types.parseA.txt index 36b285bc7..ec531678f 100644 --- a/test/fixtures/go/parameter-declarations-with-types.parseA.txt +++ b/test/fixtures/go/parameter-declarations-with-types.parseA.txt @@ -4,14 +4,16 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) ( - (Identifier) - (Identifier)) - ( - (Identifier) - (Identifier)) + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier))) ([]))) diff --git a/test/fixtures/go/parameter-declarations-with-types.parseB.txt b/test/fixtures/go/parameter-declarations-with-types.parseB.txt index 36b285bc7..ec531678f 100644 --- a/test/fixtures/go/parameter-declarations-with-types.parseB.txt +++ b/test/fixtures/go/parameter-declarations-with-types.parseB.txt @@ -4,14 +4,16 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) ( - (Identifier) - (Identifier)) - ( - (Identifier) - (Identifier)) + ( + (Identifier) + (Identifier)) + ( + (Identifier) + (Identifier))) ([]))) diff --git a/test/fixtures/go/pointer-types.diffA-B.txt b/test/fixtures/go/pointer-types.diffA-B.txt index 347c199fa..0fe8581a6 100644 --- a/test/fixtures/go/pointer-types.diffA-B.txt +++ b/test/fixtures/go/pointer-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/pointer-types.diffB-A.txt b/test/fixtures/go/pointer-types.diffB-A.txt index 347c199fa..0fe8581a6 100644 --- a/test/fixtures/go/pointer-types.diffB-A.txt +++ b/test/fixtures/go/pointer-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/pointer-types.parseA.txt b/test/fixtures/go/pointer-types.parseA.txt index c981ad2f1..b72eb4473 100644 --- a/test/fixtures/go/pointer-types.parseA.txt +++ b/test/fixtures/go/pointer-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/pointer-types.parseB.txt b/test/fixtures/go/pointer-types.parseB.txt index c981ad2f1..b72eb4473 100644 --- a/test/fixtures/go/pointer-types.parseB.txt +++ b/test/fixtures/go/pointer-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/qualified-types.diffA-B.txt b/test/fixtures/go/qualified-types.diffA-B.txt index 68a12a4c3..707b199ec 100644 --- a/test/fixtures/go/qualified-types.diffA-B.txt +++ b/test/fixtures/go/qualified-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation { (Identifier) diff --git a/test/fixtures/go/qualified-types.diffB-A.txt b/test/fixtures/go/qualified-types.diffB-A.txt index 68a12a4c3..707b199ec 100644 --- a/test/fixtures/go/qualified-types.diffB-A.txt +++ b/test/fixtures/go/qualified-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation { (Identifier) diff --git a/test/fixtures/go/qualified-types.parseA.txt b/test/fixtures/go/qualified-types.parseA.txt index 67f7f2eaf..38f470bb1 100644 --- a/test/fixtures/go/qualified-types.parseA.txt +++ b/test/fixtures/go/qualified-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/qualified-types.parseB.txt b/test/fixtures/go/qualified-types.parseB.txt index 67f7f2eaf..38f470bb1 100644 --- a/test/fixtures/go/qualified-types.parseB.txt +++ b/test/fixtures/go/qualified-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 821631b38..37921a346 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Select ( (Pattern diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 821631b38..37921a346 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Select ( (Pattern diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index e11b4060b..370e11128 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Select ( (Pattern diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index e11b4060b..370e11128 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Select ( (Pattern diff --git a/test/fixtures/go/selector-expressions.diffA-B.txt b/test/fixtures/go/selector-expressions.diffA-B.txt index f69991019..069723583 100644 --- a/test/fixtures/go/selector-expressions.diffA-B.txt +++ b/test/fixtures/go/selector-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Call (MemberAccess (MemberAccess diff --git a/test/fixtures/go/selector-expressions.diffB-A.txt b/test/fixtures/go/selector-expressions.diffB-A.txt index f69991019..069723583 100644 --- a/test/fixtures/go/selector-expressions.diffB-A.txt +++ b/test/fixtures/go/selector-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Call (MemberAccess (MemberAccess diff --git a/test/fixtures/go/selector-expressions.parseA.txt b/test/fixtures/go/selector-expressions.parseA.txt index 250364338..6d25e7a42 100644 --- a/test/fixtures/go/selector-expressions.parseA.txt +++ b/test/fixtures/go/selector-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Call (MemberAccess (MemberAccess diff --git a/test/fixtures/go/selector-expressions.parseB.txt b/test/fixtures/go/selector-expressions.parseB.txt index 250364338..6d25e7a42 100644 --- a/test/fixtures/go/selector-expressions.parseB.txt +++ b/test/fixtures/go/selector-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Call (MemberAccess (MemberAccess diff --git a/test/fixtures/go/send-statements.diffA-B.txt b/test/fixtures/go/send-statements.diffA-B.txt index 24ca88623..82e250741 100644 --- a/test/fixtures/go/send-statements.diffA-B.txt +++ b/test/fixtures/go/send-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Send { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/send-statements.diffB-A.txt b/test/fixtures/go/send-statements.diffB-A.txt index 24ca88623..82e250741 100644 --- a/test/fixtures/go/send-statements.diffB-A.txt +++ b/test/fixtures/go/send-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Send { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/send-statements.parseA.txt b/test/fixtures/go/send-statements.parseA.txt index 3c3901a4c..4ff90a0d8 100644 --- a/test/fixtures/go/send-statements.parseA.txt +++ b/test/fixtures/go/send-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Send (Identifier) (Integer)))) diff --git a/test/fixtures/go/send-statements.parseB.txt b/test/fixtures/go/send-statements.parseB.txt index 3c3901a4c..4ff90a0d8 100644 --- a/test/fixtures/go/send-statements.parseB.txt +++ b/test/fixtures/go/send-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Send (Identifier) (Integer)))) diff --git a/test/fixtures/go/short-var-declarations.diffA-B.txt b/test/fixtures/go/short-var-declarations.diffA-B.txt index b5539f688..aa0377993 100644 --- a/test/fixtures/go/short-var-declarations.diffA-B.txt +++ b/test/fixtures/go/short-var-declarations.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment ( { (Identifier) diff --git a/test/fixtures/go/short-var-declarations.diffB-A.txt b/test/fixtures/go/short-var-declarations.diffB-A.txt index b5539f688..aa0377993 100644 --- a/test/fixtures/go/short-var-declarations.diffB-A.txt +++ b/test/fixtures/go/short-var-declarations.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment ( { (Identifier) diff --git a/test/fixtures/go/short-var-declarations.parseA.txt b/test/fixtures/go/short-var-declarations.parseA.txt index bfcfcf674..a9818a78a 100644 --- a/test/fixtures/go/short-var-declarations.parseA.txt +++ b/test/fixtures/go/short-var-declarations.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment ( (Identifier) diff --git a/test/fixtures/go/short-var-declarations.parseB.txt b/test/fixtures/go/short-var-declarations.parseB.txt index bfcfcf674..a9818a78a 100644 --- a/test/fixtures/go/short-var-declarations.parseB.txt +++ b/test/fixtures/go/short-var-declarations.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment ( (Identifier) diff --git a/test/fixtures/go/single-import-declarations.diffA-B.txt b/test/fixtures/go/single-import-declarations.diffA-B.txt index f6b326f7a..d76742c13 100644 --- a/test/fixtures/go/single-import-declarations.diffA-B.txt +++ b/test/fixtures/go/single-import-declarations.diffA-B.txt @@ -15,4 +15,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/single-import-declarations.diffB-A.txt b/test/fixtures/go/single-import-declarations.diffB-A.txt index f6b326f7a..d76742c13 100644 --- a/test/fixtures/go/single-import-declarations.diffB-A.txt +++ b/test/fixtures/go/single-import-declarations.diffB-A.txt @@ -15,4 +15,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/single-import-declarations.parseA.txt b/test/fixtures/go/single-import-declarations.parseA.txt index 8d5330836..52b20c769 100644 --- a/test/fixtures/go/single-import-declarations.parseA.txt +++ b/test/fixtures/go/single-import-declarations.parseA.txt @@ -12,4 +12,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/single-import-declarations.parseB.txt b/test/fixtures/go/single-import-declarations.parseB.txt index 8d5330836..52b20c769 100644 --- a/test/fixtures/go/single-import-declarations.parseB.txt +++ b/test/fixtures/go/single-import-declarations.parseB.txt @@ -12,4 +12,5 @@ (Function (Empty) (Identifier) + ([]) ([]))) diff --git a/test/fixtures/go/single-line-function-declarations.diffA-B.txt b/test/fixtures/go/single-line-function-declarations.diffA-B.txt index 5480b9ff3..f4cd01488 100644 --- a/test/fixtures/go/single-line-function-declarations.diffA-B.txt +++ b/test/fixtures/go/single-line-function-declarations.diffA-B.txt @@ -4,11 +4,13 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) { (Identifier) ->(Identifier) } + ([]) (Call (Identifier) (Empty))) @@ -16,6 +18,7 @@ (Empty) { (Identifier) ->(Identifier) } + ([]) ( (Call (Identifier) @@ -27,6 +30,7 @@ (Empty) { (Identifier) ->(Identifier) } + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/single-line-function-declarations.diffB-A.txt b/test/fixtures/go/single-line-function-declarations.diffB-A.txt index 5480b9ff3..f4cd01488 100644 --- a/test/fixtures/go/single-line-function-declarations.diffB-A.txt +++ b/test/fixtures/go/single-line-function-declarations.diffB-A.txt @@ -4,11 +4,13 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) { (Identifier) ->(Identifier) } + ([]) (Call (Identifier) (Empty))) @@ -16,6 +18,7 @@ (Empty) { (Identifier) ->(Identifier) } + ([]) ( (Call (Identifier) @@ -27,6 +30,7 @@ (Empty) { (Identifier) ->(Identifier) } + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/single-line-function-declarations.parseA.txt b/test/fixtures/go/single-line-function-declarations.parseA.txt index 623e8d86b..7e0260a22 100644 --- a/test/fixtures/go/single-line-function-declarations.parseA.txt +++ b/test/fixtures/go/single-line-function-declarations.parseA.txt @@ -4,16 +4,19 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) + ([]) (Call (Identifier) (Empty))) (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) @@ -24,6 +27,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/single-line-function-declarations.parseB.txt b/test/fixtures/go/single-line-function-declarations.parseB.txt index 623e8d86b..7e0260a22 100644 --- a/test/fixtures/go/single-line-function-declarations.parseB.txt +++ b/test/fixtures/go/single-line-function-declarations.parseB.txt @@ -4,16 +4,19 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) + ([]) (Call (Identifier) (Empty))) (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) @@ -24,6 +27,7 @@ (Function (Empty) (Identifier) + ([]) ( (Call (Identifier) diff --git a/test/fixtures/go/slice-literals.diffA-B.txt b/test/fixtures/go/slice-literals.diffA-B.txt index 269925ed9..9619d3217 100644 --- a/test/fixtures/go/slice-literals.diffA-B.txt +++ b/test/fixtures/go/slice-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/slice-literals.diffB-A.txt b/test/fixtures/go/slice-literals.diffB-A.txt index 77f717d4d..93d518e38 100644 --- a/test/fixtures/go/slice-literals.diffB-A.txt +++ b/test/fixtures/go/slice-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/slice-literals.parseA.txt b/test/fixtures/go/slice-literals.parseA.txt index 793f229bc..ac4a089c7 100644 --- a/test/fixtures/go/slice-literals.parseA.txt +++ b/test/fixtures/go/slice-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/slice-literals.parseB.txt b/test/fixtures/go/slice-literals.parseB.txt index 95c762b15..2da569723 100644 --- a/test/fixtures/go/slice-literals.parseB.txt +++ b/test/fixtures/go/slice-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/slice-types.diffA-B.txt b/test/fixtures/go/slice-types.diffA-B.txt index c86133c56..65b82b053 100644 --- a/test/fixtures/go/slice-types.diffA-B.txt +++ b/test/fixtures/go/slice-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/slice-types.diffB-A.txt b/test/fixtures/go/slice-types.diffB-A.txt index 76add9bf7..4ee59cacb 100644 --- a/test/fixtures/go/slice-types.diffB-A.txt +++ b/test/fixtures/go/slice-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/slice-types.parseA.txt b/test/fixtures/go/slice-types.parseA.txt index 53a712cc2..42c279a11 100644 --- a/test/fixtures/go/slice-types.parseA.txt +++ b/test/fixtures/go/slice-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/slice-types.parseB.txt b/test/fixtures/go/slice-types.parseB.txt index 31875ab68..b0fda9ec1 100644 --- a/test/fixtures/go/slice-types.parseB.txt +++ b/test/fixtures/go/slice-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/string-literals.diffA-B.txt b/test/fixtures/go/string-literals.diffA-B.txt index 6273e762b..ad5dc95a5 100644 --- a/test/fixtures/go/string-literals.diffA-B.txt +++ b/test/fixtures/go/string-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/string-literals.diffB-A.txt b/test/fixtures/go/string-literals.diffB-A.txt index 6273e762b..ad5dc95a5 100644 --- a/test/fixtures/go/string-literals.diffB-A.txt +++ b/test/fixtures/go/string-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/string-literals.parseA.txt b/test/fixtures/go/string-literals.parseA.txt index 87c1e17bd..0b7550d56 100644 --- a/test/fixtures/go/string-literals.parseA.txt +++ b/test/fixtures/go/string-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/string-literals.parseB.txt b/test/fixtures/go/string-literals.parseB.txt index 87c1e17bd..0b7550d56 100644 --- a/test/fixtures/go/string-literals.parseB.txt +++ b/test/fixtures/go/string-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/struct-field-declarations.diffA-B.txt b/test/fixtures/go/struct-field-declarations.diffA-B.txt index d362256ef..23fe4a17f 100644 --- a/test/fixtures/go/struct-field-declarations.diffA-B.txt +++ b/test/fixtures/go/struct-field-declarations.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/struct-field-declarations.diffB-A.txt b/test/fixtures/go/struct-field-declarations.diffB-A.txt index 5f9766134..1b2554efe 100644 --- a/test/fixtures/go/struct-field-declarations.diffB-A.txt +++ b/test/fixtures/go/struct-field-declarations.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/struct-field-declarations.parseA.txt b/test/fixtures/go/struct-field-declarations.parseA.txt index aa51b2f40..a6a80d6a7 100644 --- a/test/fixtures/go/struct-field-declarations.parseA.txt +++ b/test/fixtures/go/struct-field-declarations.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/struct-field-declarations.parseB.txt b/test/fixtures/go/struct-field-declarations.parseB.txt index 7c260159a..bdffe6190 100644 --- a/test/fixtures/go/struct-field-declarations.parseB.txt +++ b/test/fixtures/go/struct-field-declarations.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Annotation (Identifier) diff --git a/test/fixtures/go/struct-literals.diffA-B.txt b/test/fixtures/go/struct-literals.diffA-B.txt index a7239de97..39087a864 100644 --- a/test/fixtures/go/struct-literals.diffA-B.txt +++ b/test/fixtures/go/struct-literals.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/struct-literals.diffB-A.txt b/test/fixtures/go/struct-literals.diffB-A.txt index a7239de97..39087a864 100644 --- a/test/fixtures/go/struct-literals.diffB-A.txt +++ b/test/fixtures/go/struct-literals.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/struct-literals.parseA.txt b/test/fixtures/go/struct-literals.parseA.txt index 451b881bd..9f5c4afb1 100644 --- a/test/fixtures/go/struct-literals.parseA.txt +++ b/test/fixtures/go/struct-literals.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/struct-literals.parseB.txt b/test/fixtures/go/struct-literals.parseB.txt index 451b881bd..9f5c4afb1 100644 --- a/test/fixtures/go/struct-literals.parseB.txt +++ b/test/fixtures/go/struct-literals.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Identifier) diff --git a/test/fixtures/go/struct-types.diffA-B.txt b/test/fixtures/go/struct-types.diffA-B.txt index d4c624a48..ea96a228c 100644 --- a/test/fixtures/go/struct-types.diffA-B.txt +++ b/test/fixtures/go/struct-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/struct-types.diffB-A.txt b/test/fixtures/go/struct-types.diffB-A.txt index d4c624a48..ea96a228c 100644 --- a/test/fixtures/go/struct-types.diffB-A.txt +++ b/test/fixtures/go/struct-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/struct-types.parseA.txt b/test/fixtures/go/struct-types.parseA.txt index 95abd736b..8f8a3623a 100644 --- a/test/fixtures/go/struct-types.parseA.txt +++ b/test/fixtures/go/struct-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/struct-types.parseB.txt b/test/fixtures/go/struct-types.parseB.txt index 95abd736b..8f8a3623a 100644 --- a/test/fixtures/go/struct-types.parseB.txt +++ b/test/fixtures/go/struct-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/switch-statements.diffA-B.txt b/test/fixtures/go/switch-statements.diffA-B.txt index ba6d7b831..f54f503b0 100644 --- a/test/fixtures/go/switch-statements.diffA-B.txt +++ b/test/fixtures/go/switch-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Match (Pattern (LessThan diff --git a/test/fixtures/go/switch-statements.diffB-A.txt b/test/fixtures/go/switch-statements.diffB-A.txt index ba6d7b831..f54f503b0 100644 --- a/test/fixtures/go/switch-statements.diffB-A.txt +++ b/test/fixtures/go/switch-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Match (Pattern (LessThan diff --git a/test/fixtures/go/switch-statements.parseA.txt b/test/fixtures/go/switch-statements.parseA.txt index c8e2b46c1..5544406b7 100644 --- a/test/fixtures/go/switch-statements.parseA.txt +++ b/test/fixtures/go/switch-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Match (Pattern (LessThan diff --git a/test/fixtures/go/switch-statements.parseB.txt b/test/fixtures/go/switch-statements.parseB.txt index c8e2b46c1..5544406b7 100644 --- a/test/fixtures/go/switch-statements.parseB.txt +++ b/test/fixtures/go/switch-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Match (Pattern (LessThan diff --git a/test/fixtures/go/type-aliases.diffA-B.txt b/test/fixtures/go/type-aliases.diffA-B.txt index 8eec0068a..ba95d3963 100644 --- a/test/fixtures/go/type-aliases.diffA-B.txt +++ b/test/fixtures/go/type-aliases.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Alias { (Identifier) diff --git a/test/fixtures/go/type-aliases.diffB-A.txt b/test/fixtures/go/type-aliases.diffB-A.txt index 8eec0068a..ba95d3963 100644 --- a/test/fixtures/go/type-aliases.diffB-A.txt +++ b/test/fixtures/go/type-aliases.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Alias { (Identifier) diff --git a/test/fixtures/go/type-aliases.parseA.txt b/test/fixtures/go/type-aliases.parseA.txt index b17cab8e9..fb8699c2f 100644 --- a/test/fixtures/go/type-aliases.parseA.txt +++ b/test/fixtures/go/type-aliases.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Alias (Identifier) diff --git a/test/fixtures/go/type-aliases.parseB.txt b/test/fixtures/go/type-aliases.parseB.txt index b17cab8e9..fb8699c2f 100644 --- a/test/fixtures/go/type-aliases.parseB.txt +++ b/test/fixtures/go/type-aliases.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Alias (Identifier) diff --git a/test/fixtures/go/type-assertion-expressions.diffA-B.txt b/test/fixtures/go/type-assertion-expressions.diffA-B.txt index 2790d23cd..76e1e4066 100644 --- a/test/fixtures/go/type-assertion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-assertion-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeAssertion { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/type-assertion-expressions.diffB-A.txt b/test/fixtures/go/type-assertion-expressions.diffB-A.txt index 2790d23cd..76e1e4066 100644 --- a/test/fixtures/go/type-assertion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-assertion-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeAssertion { (Identifier) ->(Identifier) } diff --git a/test/fixtures/go/type-assertion-expressions.parseA.txt b/test/fixtures/go/type-assertion-expressions.parseA.txt index 67e138ff6..db4fc8acc 100644 --- a/test/fixtures/go/type-assertion-expressions.parseA.txt +++ b/test/fixtures/go/type-assertion-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeAssertion (Identifier) (MemberAccess diff --git a/test/fixtures/go/type-assertion-expressions.parseB.txt b/test/fixtures/go/type-assertion-expressions.parseB.txt index 67e138ff6..db4fc8acc 100644 --- a/test/fixtures/go/type-assertion-expressions.parseB.txt +++ b/test/fixtures/go/type-assertion-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeAssertion (Identifier) (MemberAccess diff --git a/test/fixtures/go/type-conversion-expressions.diffA-B.txt b/test/fixtures/go/type-conversion-expressions.diffA-B.txt index 04fe6dc22..f19295475 100644 --- a/test/fixtures/go/type-conversion-expressions.diffA-B.txt +++ b/test/fixtures/go/type-conversion-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (TypeConversion (Pointer @@ -16,13 +17,11 @@ { (Identifier) ->(Identifier) } (Empty)) - (Receive - (Empty) - (TypeConversion - (BiDirectionalChannel - (Identifier)) - { (Identifier) - ->(Identifier) })) + (TypeConversion + (ReceiveChannel + (Identifier)) + { (Identifier) + ->(Identifier) }) (TypeConversion (ParenthesizedType (ReceiveChannel @@ -31,23 +30,27 @@ ->(Identifier) }) (TypeConversion (Function + ([]) (Empty)) { (Identifier) ->(Identifier) }) (TypeConversion (ParenthesizedType (Function + ([]) (Empty))) { (Identifier) ->(Identifier) }) (TypeConversion (ParenthesizedType (Function + ([]) (Identifier))) { (Identifier) ->(Identifier) }) (TypeConversion (Function + ([]) (Identifier)) { (Identifier) ->(Identifier) }) diff --git a/test/fixtures/go/type-conversion-expressions.diffB-A.txt b/test/fixtures/go/type-conversion-expressions.diffB-A.txt index 04fe6dc22..f19295475 100644 --- a/test/fixtures/go/type-conversion-expressions.diffB-A.txt +++ b/test/fixtures/go/type-conversion-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (TypeConversion (Pointer @@ -16,13 +17,11 @@ { (Identifier) ->(Identifier) } (Empty)) - (Receive - (Empty) - (TypeConversion - (BiDirectionalChannel - (Identifier)) - { (Identifier) - ->(Identifier) })) + (TypeConversion + (ReceiveChannel + (Identifier)) + { (Identifier) + ->(Identifier) }) (TypeConversion (ParenthesizedType (ReceiveChannel @@ -31,23 +30,27 @@ ->(Identifier) }) (TypeConversion (Function + ([]) (Empty)) { (Identifier) ->(Identifier) }) (TypeConversion (ParenthesizedType (Function + ([]) (Empty))) { (Identifier) ->(Identifier) }) (TypeConversion (ParenthesizedType (Function + ([]) (Identifier))) { (Identifier) ->(Identifier) }) (TypeConversion (Function + ([]) (Identifier)) { (Identifier) ->(Identifier) }) diff --git a/test/fixtures/go/type-conversion-expressions.parseA.txt b/test/fixtures/go/type-conversion-expressions.parseA.txt index 95c20290f..dd6682b1f 100644 --- a/test/fixtures/go/type-conversion-expressions.parseA.txt +++ b/test/fixtures/go/type-conversion-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (TypeConversion (Pointer @@ -14,12 +15,10 @@ (Identifier)) (Identifier) (Empty)) - (Receive - (Empty) - (TypeConversion - (BiDirectionalChannel - (Identifier)) - (Identifier))) + (TypeConversion + (ReceiveChannel + (Identifier)) + (Identifier)) (TypeConversion (ParenthesizedType (ReceiveChannel @@ -27,20 +26,24 @@ (Identifier)) (TypeConversion (Function + ([]) (Empty)) (Identifier)) (TypeConversion (ParenthesizedType (Function + ([]) (Empty))) (Identifier)) (TypeConversion (ParenthesizedType (Function + ([]) (Identifier))) (Identifier)) (TypeConversion (Function + ([]) (Identifier)) (Identifier)) (TypeConversion diff --git a/test/fixtures/go/type-conversion-expressions.parseB.txt b/test/fixtures/go/type-conversion-expressions.parseB.txt index 95c20290f..dd6682b1f 100644 --- a/test/fixtures/go/type-conversion-expressions.parseB.txt +++ b/test/fixtures/go/type-conversion-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (TypeConversion (Pointer @@ -14,12 +15,10 @@ (Identifier)) (Identifier) (Empty)) - (Receive - (Empty) - (TypeConversion - (BiDirectionalChannel - (Identifier)) - (Identifier))) + (TypeConversion + (ReceiveChannel + (Identifier)) + (Identifier)) (TypeConversion (ParenthesizedType (ReceiveChannel @@ -27,20 +26,24 @@ (Identifier)) (TypeConversion (Function + ([]) (Empty)) (Identifier)) (TypeConversion (ParenthesizedType (Function + ([]) (Empty))) (Identifier)) (TypeConversion (ParenthesizedType (Function + ([]) (Identifier))) (Identifier)) (TypeConversion (Function + ([]) (Identifier)) (Identifier)) (TypeConversion diff --git a/test/fixtures/go/type-declarations.diffA-B.txt b/test/fixtures/go/type-declarations.diffA-B.txt index b8acd1ecf..897c27029 100644 --- a/test/fixtures/go/type-declarations.diffA-B.txt +++ b/test/fixtures/go/type-declarations.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/type-declarations.diffB-A.txt b/test/fixtures/go/type-declarations.diffB-A.txt index b8acd1ecf..897c27029 100644 --- a/test/fixtures/go/type-declarations.diffB-A.txt +++ b/test/fixtures/go/type-declarations.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/type-declarations.parseA.txt b/test/fixtures/go/type-declarations.parseA.txt index b5e290f99..5c071263f 100644 --- a/test/fixtures/go/type-declarations.parseA.txt +++ b/test/fixtures/go/type-declarations.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/type-declarations.parseB.txt b/test/fixtures/go/type-declarations.parseB.txt index b5e290f99..5c071263f 100644 --- a/test/fixtures/go/type-declarations.parseB.txt +++ b/test/fixtures/go/type-declarations.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( ( (Annotation diff --git a/test/fixtures/go/type-switch-statements.diffA-B.txt b/test/fixtures/go/type-switch-statements.diffA-B.txt index 9e281b3c8..96f952a14 100644 --- a/test/fixtures/go/type-switch-statements.diffA-B.txt +++ b/test/fixtures/go/type-switch-statements.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeSwitch ( (Assignment diff --git a/test/fixtures/go/type-switch-statements.diffB-A.txt b/test/fixtures/go/type-switch-statements.diffB-A.txt index 8f744ad41..6bfcbb891 100644 --- a/test/fixtures/go/type-switch-statements.diffB-A.txt +++ b/test/fixtures/go/type-switch-statements.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeSwitch ( (Assignment diff --git a/test/fixtures/go/type-switch-statements.parseA.txt b/test/fixtures/go/type-switch-statements.parseA.txt index d54744e9e..2e0b6e782 100644 --- a/test/fixtures/go/type-switch-statements.parseA.txt +++ b/test/fixtures/go/type-switch-statements.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeSwitch ( (Assignment diff --git a/test/fixtures/go/type-switch-statements.parseB.txt b/test/fixtures/go/type-switch-statements.parseB.txt index bd15360c4..925194b95 100644 --- a/test/fixtures/go/type-switch-statements.parseB.txt +++ b/test/fixtures/go/type-switch-statements.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (TypeSwitch ( (Assignment diff --git a/test/fixtures/go/unary-expressions.diffA-B.txt b/test/fixtures/go/unary-expressions.diffA-B.txt index 4c795ea20..f9af9d639 100644 --- a/test/fixtures/go/unary-expressions.diffA-B.txt +++ b/test/fixtures/go/unary-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Not (Receive diff --git a/test/fixtures/go/unary-expressions.diffB-A.txt b/test/fixtures/go/unary-expressions.diffB-A.txt index 4c795ea20..f9af9d639 100644 --- a/test/fixtures/go/unary-expressions.diffB-A.txt +++ b/test/fixtures/go/unary-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Not (Receive diff --git a/test/fixtures/go/unary-expressions.parseA.txt b/test/fixtures/go/unary-expressions.parseA.txt index d0c9012f0..ebb17cf85 100644 --- a/test/fixtures/go/unary-expressions.parseA.txt +++ b/test/fixtures/go/unary-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Not (Receive diff --git a/test/fixtures/go/unary-expressions.parseB.txt b/test/fixtures/go/unary-expressions.parseB.txt index d0c9012f0..ebb17cf85 100644 --- a/test/fixtures/go/unary-expressions.parseB.txt +++ b/test/fixtures/go/unary-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Not (Receive diff --git a/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt b/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt index 17773cb02..657fb78fc 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt b/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt index 17773cb02..657fb78fc 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt b/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt index 0d017abb4..fcbc169a5 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt b/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt index 0d017abb4..fcbc169a5 100644 --- a/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt +++ b/test/fixtures/go/var-declarations-with-no-expressions.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-types.diffA-B.txt b/test/fixtures/go/var-declarations-with-types.diffA-B.txt index ca0ebb1ce..87f2be011 100644 --- a/test/fixtures/go/var-declarations-with-types.diffA-B.txt +++ b/test/fixtures/go/var-declarations-with-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-types.diffB-A.txt b/test/fixtures/go/var-declarations-with-types.diffB-A.txt index ca0ebb1ce..87f2be011 100644 --- a/test/fixtures/go/var-declarations-with-types.diffB-A.txt +++ b/test/fixtures/go/var-declarations-with-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-types.parseA.txt b/test/fixtures/go/var-declarations-with-types.parseA.txt index add301f11..6b2e634ff 100644 --- a/test/fixtures/go/var-declarations-with-types.parseA.txt +++ b/test/fixtures/go/var-declarations-with-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-with-types.parseB.txt b/test/fixtures/go/var-declarations-with-types.parseB.txt index add301f11..6b2e634ff 100644 --- a/test/fixtures/go/var-declarations-with-types.parseB.txt +++ b/test/fixtures/go/var-declarations-with-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) ( (Assignment (Annotation diff --git a/test/fixtures/go/var-declarations-without-types.diffA-B.txt b/test/fixtures/go/var-declarations-without-types.diffA-B.txt index 804caeb9b..f04f21606 100644 --- a/test/fixtures/go/var-declarations-without-types.diffA-B.txt +++ b/test/fixtures/go/var-declarations-without-types.diffA-B.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment { (Identifier) ->( diff --git a/test/fixtures/go/var-declarations-without-types.diffB-A.txt b/test/fixtures/go/var-declarations-without-types.diffB-A.txt index 7796835c1..c6c0d76a2 100644 --- a/test/fixtures/go/var-declarations-without-types.diffB-A.txt +++ b/test/fixtures/go/var-declarations-without-types.diffB-A.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment { ( {-(Identifier)-} diff --git a/test/fixtures/go/var-declarations-without-types.parseA.txt b/test/fixtures/go/var-declarations-without-types.parseA.txt index a2d50974f..0e708ae6a 100644 --- a/test/fixtures/go/var-declarations-without-types.parseA.txt +++ b/test/fixtures/go/var-declarations-without-types.parseA.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment (Identifier) (Integer)))) diff --git a/test/fixtures/go/var-declarations-without-types.parseB.txt b/test/fixtures/go/var-declarations-without-types.parseB.txt index bfcfcf674..a9818a78a 100644 --- a/test/fixtures/go/var-declarations-without-types.parseB.txt +++ b/test/fixtures/go/var-declarations-without-types.parseB.txt @@ -4,6 +4,7 @@ (Function (Empty) (Identifier) + ([]) (Assignment ( (Identifier) diff --git a/test/fixtures/go/variadic-function-declarations.diffA-B.txt b/test/fixtures/go/variadic-function-declarations.diffA-B.txt index 89196f558..15c0c0761 100644 --- a/test/fixtures/go/variadic-function-declarations.diffA-B.txt +++ b/test/fixtures/go/variadic-function-declarations.diffA-B.txt @@ -4,30 +4,34 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) { (Identifier) ->(Identifier) } - (Variadic - (Pointer - (Identifier)) - (Identifier)) + ( + (Variadic + (Pointer + (Identifier)) + (Identifier))) ([])) (Function (Empty) { (Identifier) ->(Identifier) } - (Variadic + ( + (Variadic + (Identifier) + (Empty))) + ([])) + (Function + (Empty) + { (Identifier) + ->(Identifier) } + ( (Identifier) - (Empty)) - ([])) - (Function - (Empty) - { (Identifier) - ->(Identifier) } - (Identifier) - (Variadic - (Identifier) - (Empty)) + (Variadic + (Identifier) + (Empty))) ([]))) diff --git a/test/fixtures/go/variadic-function-declarations.diffB-A.txt b/test/fixtures/go/variadic-function-declarations.diffB-A.txt index 89196f558..15c0c0761 100644 --- a/test/fixtures/go/variadic-function-declarations.diffB-A.txt +++ b/test/fixtures/go/variadic-function-declarations.diffB-A.txt @@ -4,30 +4,34 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) { (Identifier) ->(Identifier) } - (Variadic - (Pointer - (Identifier)) - (Identifier)) + ( + (Variadic + (Pointer + (Identifier)) + (Identifier))) ([])) (Function (Empty) { (Identifier) ->(Identifier) } - (Variadic + ( + (Variadic + (Identifier) + (Empty))) + ([])) + (Function + (Empty) + { (Identifier) + ->(Identifier) } + ( (Identifier) - (Empty)) - ([])) - (Function - (Empty) - { (Identifier) - ->(Identifier) } - (Identifier) - (Variadic - (Identifier) - (Empty)) + (Variadic + (Identifier) + (Empty))) ([]))) diff --git a/test/fixtures/go/variadic-function-declarations.parseA.txt b/test/fixtures/go/variadic-function-declarations.parseA.txt index 4deeea5dc..83ca873c9 100644 --- a/test/fixtures/go/variadic-function-declarations.parseA.txt +++ b/test/fixtures/go/variadic-function-declarations.parseA.txt @@ -4,27 +4,31 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) - (Variadic - (Pointer - (Identifier)) - (Identifier)) + ( + (Variadic + (Pointer + (Identifier)) + (Identifier))) ([])) (Function (Empty) (Identifier) - (Variadic + ( + (Variadic + (Identifier) + (Empty))) + ([])) + (Function + (Empty) + (Identifier) + ( (Identifier) - (Empty)) - ([])) - (Function - (Empty) - (Identifier) - (Identifier) - (Variadic - (Identifier) - (Empty)) + (Variadic + (Identifier) + (Empty))) ([]))) diff --git a/test/fixtures/go/variadic-function-declarations.parseB.txt b/test/fixtures/go/variadic-function-declarations.parseB.txt index 4deeea5dc..83ca873c9 100644 --- a/test/fixtures/go/variadic-function-declarations.parseB.txt +++ b/test/fixtures/go/variadic-function-declarations.parseB.txt @@ -4,27 +4,31 @@ (Function (Empty) (Identifier) + ([]) ([])) (Function (Empty) (Identifier) - (Variadic - (Pointer - (Identifier)) - (Identifier)) + ( + (Variadic + (Pointer + (Identifier)) + (Identifier))) ([])) (Function (Empty) (Identifier) - (Variadic + ( + (Variadic + (Identifier) + (Empty))) + ([])) + (Function + (Empty) + (Identifier) + ( (Identifier) - (Empty)) - ([])) - (Function - (Empty) - (Identifier) - (Identifier) - (Variadic - (Identifier) - (Empty)) + (Variadic + (Identifier) + (Empty))) ([]))) From 105a6adace397b86d5c2a1305e743814a319e278 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 13:49:15 -0800 Subject: [PATCH 165/176] :fire: parens --- src/Language/Go/Assignment.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index edea1b7d2..b84c9c0e6 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -273,9 +273,9 @@ sliceType :: Assignment sliceType = makeTerm <$> symbol SliceType <*> children (Type.Slice <$> expression) channelType :: Assignment -channelType = (makeTerm <$> symbol ChannelType <*> (children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression)))) - <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression)))) - <|> (makeTerm <$> symbol ChannelType <*> (children (token AnonChan *> (Type.BiDirectionalChannel <$> expression)))) +channelType = (makeTerm <$> symbol ChannelType <*> children (token AnonLAngleMinus *> token AnonChan *> (Type.ReceiveChannel <$> expression))) + <|> (makeTerm <$> symbol ChannelType <*> children (token AnonChan *> token AnonLAngleMinus *> (Type.SendChannel <$> expression))) + <|> (makeTerm <$> symbol ChannelType <*> children (token AnonChan *> (Type.BiDirectionalChannel <$> expression))) structType :: Assignment structType = handleError $ makeTerm <$> symbol StructType <*> children (Declaration.Constructor <$> emptyTerm <*> many expression) From 1564d7f029e031c14da50fcb5d77992e10374963 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 13:49:29 -0800 Subject: [PATCH 166/176] Allow expressions within type switch guards --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index b84c9c0e6..de10e55eb 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -433,7 +433,7 @@ typeSwitchStatement = makeTerm <$> symbol TypeSwitchStatement <*> children (Go.S _typeSwitchSubject = makeTerm <$> location <*> manyTermsTill expression (void (symbol TypeCaseClause)) typeSwitchGuard :: Assignment -typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expression) +typeSwitchGuard = makeTerm <$> symbol Grammar.TypeSwitchGuard <*> children (Go.Syntax.TypeSwitchGuard <$> expressions) typeCaseClause :: Assignment typeCaseClause = makeTerm <$> symbol TypeCaseClause <*> children (Statement.Pattern <$> expression <*> expressions) From 2ccc5e97864f6c9514e0077f2da1353471338321 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 13:54:14 -0800 Subject: [PATCH 167/176] Update type switch statement tests --- test/fixtures/go/type-switch-statements.A.go | 10 ++ test/fixtures/go/type-switch-statements.B.go | 10 ++ .../go/type-switch-statements.diffA-B.txt | 132 ++++++++++++++---- .../go/type-switch-statements.diffB-A.txt | 132 ++++++++++++++---- .../go/type-switch-statements.parseA.txt | 96 ++++++++++--- .../go/type-switch-statements.parseB.txt | 106 +++++++++++--- 6 files changed, 395 insertions(+), 91 deletions(-) diff --git a/test/fixtures/go/type-switch-statements.A.go b/test/fixtures/go/type-switch-statements.A.go index 9db64b906..cce33e064 100644 --- a/test/fixtures/go/type-switch-statements.A.go +++ b/test/fixtures/go/type-switch-statements.A.go @@ -7,4 +7,14 @@ switch c := d; f.(type) { case *Dog: break } +switch v := i.(type) { +case int: + fmt.Println("twice i is", v*2) +case float64: + fmt.Println("the reciprocal of i is", 1/v) +case string: + h := len(v) / 2 + fmt.Println("i swapped by halves is", v[h:]+v[:h]) +default: +} } diff --git a/test/fixtures/go/type-switch-statements.B.go b/test/fixtures/go/type-switch-statements.B.go index adcaf1deb..cce9accd7 100644 --- a/test/fixtures/go/type-switch-statements.B.go +++ b/test/fixtures/go/type-switch-statements.B.go @@ -9,4 +9,14 @@ switch a := b; e.(type) { default: break } +switch x := j.(type) { +case float64: + fmt.Println("the reciprocal of i is", 1/x) +case int: + fmt.Println("twice i is", x*2) +case string: + l := len(x) / 2 + fmt.Println("i swapped by halves is", x[l:]+x[:l]) +default: +} } diff --git a/test/fixtures/go/type-switch-statements.diffA-B.txt b/test/fixtures/go/type-switch-statements.diffA-B.txt index 96f952a14..6b0223ac1 100644 --- a/test/fixtures/go/type-switch-statements.diffA-B.txt +++ b/test/fixtures/go/type-switch-statements.diffA-B.txt @@ -5,30 +5,110 @@ (Empty) (Identifier) ([]) - (TypeSwitch - ( - (Assignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (TypeSwitchGuard - { (Identifier) - ->(Identifier) })) - ( - (Pattern - (Slice - (Identifier)) - (Call + ( + (TypeSwitch + ( + (Assignment + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (TypeSwitchGuard + { (Identifier) + ->(Identifier) })) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))) + {+(Pattern + {+(DefaultPattern + {+([])+})+} + {+(Break + {+(Empty)+})+})+})) + (TypeSwitch + ( + (TypeSwitchGuard + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))) + ( + (Pattern + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (TextElement) + ->(TextElement) } + {+(DividedBy + {+(Integer)+} + {+(Identifier)+})+} + {-(Times + {-(Identifier)-} + {-(Integer)-})-} + (Empty))) + (Pattern + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (TextElement) + ->(TextElement) } + {+(Times + {+(Identifier)+} + {+(Integer)+})+} + {-(DividedBy + {-(Integer)-} + {-(Identifier)-})-} + (Empty))) + (Pattern (Identifier) - (Empty))) - (Pattern - (Pointer - (Identifier)) - (Break - (Empty))) - {+(Pattern - {+(DefaultPattern - {+([])+})+} - {+(Break - {+(Empty)+})+})+})))) + ( + (Assignment + { (Identifier) + ->(Identifier) } + (DividedBy + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)) + (Integer))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (Plus + (Slice + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Empty) + (Empty)) + (Slice + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Empty) + (Empty))) + (Empty)))) + (Pattern + (DefaultPattern + ([])) + ([]))))))) diff --git a/test/fixtures/go/type-switch-statements.diffB-A.txt b/test/fixtures/go/type-switch-statements.diffB-A.txt index 6bfcbb891..99c27ef4f 100644 --- a/test/fixtures/go/type-switch-statements.diffB-A.txt +++ b/test/fixtures/go/type-switch-statements.diffB-A.txt @@ -5,30 +5,110 @@ (Empty) (Identifier) ([]) - (TypeSwitch - ( - (Assignment - { (Identifier) - ->(Identifier) } - { (Identifier) - ->(Identifier) }) - (TypeSwitchGuard - { (Identifier) - ->(Identifier) })) - ( - (Pattern - (Slice - (Identifier)) - (Call + ( + (TypeSwitch + ( + (Assignment + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }) + (TypeSwitchGuard + { (Identifier) + ->(Identifier) })) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))) + {-(Pattern + {-(DefaultPattern + {-([])-})-} + {-(Break + {-(Empty)-})-})-})) + (TypeSwitch + ( + (TypeSwitchGuard + ( + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) }))) + ( + (Pattern + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (TextElement) + ->(TextElement) } + {+(Times + {+(Identifier)+} + {+(Integer)+})+} + {-(DividedBy + {-(Integer)-} + {-(Identifier)-})-} + (Empty))) + (Pattern + { (Identifier) + ->(Identifier) } + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (TextElement) + ->(TextElement) } + {+(DividedBy + {+(Integer)+} + {+(Identifier)+})+} + {-(Times + {-(Identifier)-} + {-(Integer)-})-} + (Empty))) + (Pattern (Identifier) - (Empty))) - (Pattern - (Pointer - (Identifier)) - (Break - (Empty))) - {-(Pattern - {-(DefaultPattern - {-([])-})-} - {-(Break - {-(Empty)-})-})-})))) + ( + (Assignment + { (Identifier) + ->(Identifier) } + (DividedBy + (Call + (Identifier) + { (Identifier) + ->(Identifier) } + (Empty)) + (Integer))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (Plus + (Slice + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Empty) + (Empty)) + (Slice + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + (Empty) + (Empty))) + (Empty)))) + (Pattern + (DefaultPattern + ([])) + ([]))))))) diff --git a/test/fixtures/go/type-switch-statements.parseA.txt b/test/fixtures/go/type-switch-statements.parseA.txt index 2e0b6e782..abb84c1f3 100644 --- a/test/fixtures/go/type-switch-statements.parseA.txt +++ b/test/fixtures/go/type-switch-statements.parseA.txt @@ -5,22 +5,84 @@ (Empty) (Identifier) ([]) - (TypeSwitch - ( - (Assignment - (Identifier) - (Identifier)) - (TypeSwitchGuard - (Identifier))) - ( - (Pattern - (Slice - (Identifier)) - (Call + ( + (TypeSwitch + ( + (Assignment (Identifier) - (Empty))) - (Pattern - (Pointer (Identifier)) - (Break - (Empty))))))) + (TypeSwitchGuard + (Identifier))) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))))) + (TypeSwitch + ( + (TypeSwitchGuard + ( + (Identifier) + (Identifier)))) + ( + (Pattern + (Identifier) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (Times + (Identifier) + (Integer)) + (Empty))) + (Pattern + (Identifier) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (DividedBy + (Integer) + (Identifier)) + (Empty))) + (Pattern + (Identifier) + ( + (Assignment + (Identifier) + (DividedBy + (Call + (Identifier) + (Identifier) + (Empty)) + (Integer))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (Plus + (Slice + (Identifier) + (Identifier) + (Empty) + (Empty)) + (Slice + (Identifier) + (Identifier) + (Empty) + (Empty))) + (Empty)))) + (Pattern + (DefaultPattern + ([])) + ([]))))))) diff --git a/test/fixtures/go/type-switch-statements.parseB.txt b/test/fixtures/go/type-switch-statements.parseB.txt index 925194b95..77823661f 100644 --- a/test/fixtures/go/type-switch-statements.parseB.txt +++ b/test/fixtures/go/type-switch-statements.parseB.txt @@ -5,27 +5,89 @@ (Empty) (Identifier) ([]) - (TypeSwitch - ( - (Assignment - (Identifier) - (Identifier)) - (TypeSwitchGuard - (Identifier))) - ( - (Pattern - (Slice - (Identifier)) - (Call + ( + (TypeSwitch + ( + (Assignment (Identifier) - (Empty))) - (Pattern - (Pointer (Identifier)) - (Break - (Empty))) - (Pattern - (DefaultPattern - ([])) - (Break - (Empty))))))) + (TypeSwitchGuard + (Identifier))) + ( + (Pattern + (Slice + (Identifier)) + (Call + (Identifier) + (Empty))) + (Pattern + (Pointer + (Identifier)) + (Break + (Empty))) + (Pattern + (DefaultPattern + ([])) + (Break + (Empty))))) + (TypeSwitch + ( + (TypeSwitchGuard + ( + (Identifier) + (Identifier)))) + ( + (Pattern + (Identifier) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (DividedBy + (Integer) + (Identifier)) + (Empty))) + (Pattern + (Identifier) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (Times + (Identifier) + (Integer)) + (Empty))) + (Pattern + (Identifier) + ( + (Assignment + (Identifier) + (DividedBy + (Call + (Identifier) + (Identifier) + (Empty)) + (Integer))) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (TextElement) + (Plus + (Slice + (Identifier) + (Identifier) + (Empty) + (Empty)) + (Slice + (Identifier) + (Identifier) + (Empty) + (Empty))) + (Empty)))) + (Pattern + (DefaultPattern + ([])) + ([]))))))) From 46cb13a4c14a3e1110ff1d936ee5c0698d84aa7d Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 14:03:50 -0800 Subject: [PATCH 168/176] Allow communication clauses to have empty bodies --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index de10e55eb..ef2af7ca8 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -603,7 +603,7 @@ selectStatement :: Assignment selectStatement = makeTerm <$> symbol SelectStatement <*> children (Go.Syntax.Select <$> expressions) communicationClause :: Assignment -communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Statement.Pattern <$> (communicationCase <|> defaultCase) <*> expression) +communicationClause = makeTerm <$> symbol CommunicationClause <*> children (Statement.Pattern <$> (communicationCase <|> defaultCase) <*> (expression <|> emptyTerm)) where communicationCase = symbol CommunicationCase *> children expression From 62f5cedf6776b2341fb16c8819c1e9e810072bc0 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 14:04:06 -0800 Subject: [PATCH 169/176] Update select statements tests --- test/fixtures/go/select-statements.A.go | 5 + test/fixtures/go/select-statements.B.go | 4 + .../fixtures/go/select-statements.diffA-B.txt | 100 +++++++++++------- .../fixtures/go/select-statements.diffB-A.txt | 100 +++++++++++------- test/fixtures/go/select-statements.parseA.txt | 91 ++++++++++------ test/fixtures/go/select-statements.parseB.txt | 87 +++++++++------ 6 files changed, 239 insertions(+), 148 deletions(-) diff --git a/test/fixtures/go/select-statements.A.go b/test/fixtures/go/select-statements.A.go index 6806fa67d..17466767a 100644 --- a/test/fixtures/go/select-statements.A.go +++ b/test/fixtures/go/select-statements.A.go @@ -11,4 +11,9 @@ select { default: return } +select { +case <-ch: +case <-timeout: +default: +} } diff --git a/test/fixtures/go/select-statements.B.go b/test/fixtures/go/select-statements.B.go index 1ca26fb9f..39a65c00a 100644 --- a/test/fixtures/go/select-statements.B.go +++ b/test/fixtures/go/select-statements.B.go @@ -11,4 +11,8 @@ select { default: return } +select { +case <-channel: +case <-timeout: +} } diff --git a/test/fixtures/go/select-statements.diffA-B.txt b/test/fixtures/go/select-statements.diffA-B.txt index 37921a346..ee21ff478 100644 --- a/test/fixtures/go/select-statements.diffA-B.txt +++ b/test/fixtures/go/select-statements.diffA-B.txt @@ -5,46 +5,68 @@ (Empty) (Identifier) ([]) - (Select - ( - (Pattern - (Receive - { (Identifier) - ->(Identifier) } + ( + (Select + ( + (Pattern + (Receive + { (Identifier) + ->(Identifier) } + (Receive + (Empty) + (Identifier))) + (Call + (Identifier) + (Identifier) + (Empty))) + (Pattern + (Send + { (Identifier) + ->(Identifier) } + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern (Receive (Empty) - (Identifier))) - (Call - (Identifier) - (Identifier) - (Empty))) - (Pattern - (Send - { (Identifier) - ->(Identifier) } - (Identifier)) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (Receive - (Empty) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (Integer) + ->(Integer) } + (Empty)))) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern + (DefaultPattern + ([])) + (Return + (Empty))))) + (Select + ( + (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - { (Integer) - ->(Integer) } - (Empty)))) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (DefaultPattern - ([])) - (Return - (Empty))))))) + (Receive + (Empty) + { (Identifier) + ->(Identifier) })) + (Empty)) + (Pattern + (Receive + (Empty) + (Receive + (Empty) + (Identifier))) + (Empty)) + {-(Pattern + {-(DefaultPattern + {-([])-})-} + {-(Empty)-})-}))))) diff --git a/test/fixtures/go/select-statements.diffB-A.txt b/test/fixtures/go/select-statements.diffB-A.txt index 37921a346..5285a5abe 100644 --- a/test/fixtures/go/select-statements.diffB-A.txt +++ b/test/fixtures/go/select-statements.diffB-A.txt @@ -5,46 +5,68 @@ (Empty) (Identifier) ([]) - (Select - ( - (Pattern - (Receive - { (Identifier) - ->(Identifier) } + ( + (Select + ( + (Pattern + (Receive + { (Identifier) + ->(Identifier) } + (Receive + (Empty) + (Identifier))) + (Call + (Identifier) + (Identifier) + (Empty))) + (Pattern + (Send + { (Identifier) + ->(Identifier) } + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern (Receive (Empty) - (Identifier))) - (Call - (Identifier) - (Identifier) - (Empty))) - (Pattern - (Send - { (Identifier) - ->(Identifier) } - (Identifier)) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (Receive - (Empty) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + { (Integer) + ->(Integer) } + (Empty)))) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern + (DefaultPattern + ([])) + (Return + (Empty))))) + (Select + ( + (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - { (Integer) - ->(Integer) } - (Empty)))) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (DefaultPattern - ([])) - (Return - (Empty))))))) + (Receive + (Empty) + { (Identifier) + ->(Identifier) })) + (Empty)) + (Pattern + (Receive + (Empty) + (Receive + (Empty) + (Identifier))) + (Empty)) + {+(Pattern + {+(DefaultPattern + {+([])+})+} + {+(Empty)+})+}))))) diff --git a/test/fixtures/go/select-statements.parseA.txt b/test/fixtures/go/select-statements.parseA.txt index 370e11128..458e98fad 100644 --- a/test/fixtures/go/select-statements.parseA.txt +++ b/test/fixtures/go/select-statements.parseA.txt @@ -5,43 +5,64 @@ (Empty) (Identifier) ([]) - (Select - ( - (Pattern - (Receive - (Identifier) + ( + (Select + ( + (Pattern + (Receive + (Identifier) + (Receive + (Empty) + (Identifier))) + (Call + (Identifier) + (Identifier) + (Empty))) + (Pattern + (Send + (Identifier) + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern (Receive (Empty) - (Identifier))) - (Call - (Identifier) - (Identifier) - (Empty))) - (Pattern - (Send - (Identifier) - (Identifier)) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (Receive - (Empty) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty)))) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern + (DefaultPattern + ([])) + (Return + (Empty))))) + (Select + ( + (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty)))) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (DefaultPattern - ([])) - (Return + (Receive + (Empty) + (Identifier))) + (Empty)) + (Pattern + (Receive + (Empty) + (Receive + (Empty) + (Identifier))) + (Empty)) + (Pattern + (DefaultPattern + ([])) (Empty))))))) diff --git a/test/fixtures/go/select-statements.parseB.txt b/test/fixtures/go/select-statements.parseB.txt index 370e11128..455110e4b 100644 --- a/test/fixtures/go/select-statements.parseB.txt +++ b/test/fixtures/go/select-statements.parseB.txt @@ -5,43 +5,60 @@ (Empty) (Identifier) ([]) - (Select - ( - (Pattern - (Receive - (Identifier) + ( + (Select + ( + (Pattern + (Receive + (Identifier) + (Receive + (Empty) + (Identifier))) + (Call + (Identifier) + (Identifier) + (Empty))) + (Pattern + (Send + (Identifier) + (Identifier)) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern (Receive (Empty) - (Identifier))) - (Call - (Identifier) - (Identifier) - (Empty))) - (Pattern - (Send - (Identifier) - (Identifier)) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (Receive - (Empty) + (Receive + (Empty) + (Call + (MemberAccess + (Identifier) + (Identifier)) + (Integer) + (Empty)))) + (Call + (Identifier) + (Integer) + (Empty))) + (Pattern + (DefaultPattern + ([])) + (Return + (Empty))))) + (Select + ( + (Pattern (Receive (Empty) - (Call - (MemberAccess - (Identifier) - (Identifier)) - (Integer) - (Empty)))) - (Call - (Identifier) - (Integer) - (Empty))) - (Pattern - (DefaultPattern - ([])) - (Return + (Receive + (Empty) + (Identifier))) + (Empty)) + (Pattern + (Receive + (Empty) + (Receive + (Empty) + (Identifier))) (Empty))))))) From f8bca432a43c73ec84249e3f74b01128c41a6508 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 14:25:01 -0800 Subject: [PATCH 170/176] Assign unary complement expressions --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ef2af7ca8..d43dffd66 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -373,7 +373,7 @@ typeConversion :: Assignment typeConversion = makeTerm <$> symbol TypeConversionExpression <*> children (Go.Syntax.TypeConversion <$> expression <*> expression) unaryExpression :: Assignment -unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive <|> unaryPointer +unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression location) <|> (unaryMinus location) <|> unaryPlus <|> unaryAmpersand <|> unaryReceive <|> unaryPointer <|> unaryComplement where notExpression location = makeTerm location . Expression.Not <$> children (symbol AnonBang *> expression) unaryMinus location = makeTerm location . Expression.Negate <$> children (symbol AnonMinus *> expression) @@ -381,6 +381,7 @@ unaryExpression = symbol UnaryExpression >>= \ location -> (notExpression locati unaryAmpersand = children (makeTerm <$> symbol AnonAmpersand <*> (Literal.Reference <$> expression)) unaryReceive = children (makeTerm <$> symbol AnonLAngleMinus <*> (Go.Syntax.Receive <$> emptyTerm <*> expression)) unaryPointer = children (makeTerm <$> symbol AnonStar <*> (Literal.Pointer <$> expression)) + unaryComplement = children (makeTerm <$> symbol AnonCaret <*> (Expression.Complement <$> expression)) binaryExpression :: Assignment binaryExpression = makeTerm' <$> symbol BinaryExpression <*> children (infixTerm expression expression From ddd35e26315c8c024e599d6f3812873dd29f33e6 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 14:25:20 -0800 Subject: [PATCH 171/176] Update unary expression test fixtures --- test/fixtures/go/unary-expressions.A.go | 1 + test/fixtures/go/unary-expressions.B.go | 1 + test/fixtures/go/unary-expressions.diffA-B.txt | 5 ++++- test/fixtures/go/unary-expressions.diffB-A.txt | 5 ++++- test/fixtures/go/unary-expressions.parseA.txt | 4 +++- test/fixtures/go/unary-expressions.parseB.txt | 4 +++- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/unary-expressions.A.go b/test/fixtures/go/unary-expressions.A.go index bdf9ccc58..b28f4e010 100644 --- a/test/fixtures/go/unary-expressions.A.go +++ b/test/fixtures/go/unary-expressions.A.go @@ -3,4 +3,5 @@ package main func main() { !<-a *foo() +^h } diff --git a/test/fixtures/go/unary-expressions.B.go b/test/fixtures/go/unary-expressions.B.go index cf8ed8826..df61b6d66 100644 --- a/test/fixtures/go/unary-expressions.B.go +++ b/test/fixtures/go/unary-expressions.B.go @@ -3,4 +3,5 @@ package main func main() { !<-b *bar() +^g } diff --git a/test/fixtures/go/unary-expressions.diffA-B.txt b/test/fixtures/go/unary-expressions.diffA-B.txt index f9af9d639..e180e39df 100644 --- a/test/fixtures/go/unary-expressions.diffA-B.txt +++ b/test/fixtures/go/unary-expressions.diffA-B.txt @@ -15,4 +15,7 @@ (Call { (Identifier) ->(Identifier) } - (Empty)))))) + (Empty))) + (Complement + { (Identifier) + ->(Identifier) })))) diff --git a/test/fixtures/go/unary-expressions.diffB-A.txt b/test/fixtures/go/unary-expressions.diffB-A.txt index f9af9d639..e180e39df 100644 --- a/test/fixtures/go/unary-expressions.diffB-A.txt +++ b/test/fixtures/go/unary-expressions.diffB-A.txt @@ -15,4 +15,7 @@ (Call { (Identifier) ->(Identifier) } - (Empty)))))) + (Empty))) + (Complement + { (Identifier) + ->(Identifier) })))) diff --git a/test/fixtures/go/unary-expressions.parseA.txt b/test/fixtures/go/unary-expressions.parseA.txt index ebb17cf85..dd1f5e2ab 100644 --- a/test/fixtures/go/unary-expressions.parseA.txt +++ b/test/fixtures/go/unary-expressions.parseA.txt @@ -13,4 +13,6 @@ (Pointer (Call (Identifier) - (Empty)))))) + (Empty))) + (Complement + (Identifier))))) diff --git a/test/fixtures/go/unary-expressions.parseB.txt b/test/fixtures/go/unary-expressions.parseB.txt index ebb17cf85..dd1f5e2ab 100644 --- a/test/fixtures/go/unary-expressions.parseB.txt +++ b/test/fixtures/go/unary-expressions.parseB.txt @@ -13,4 +13,6 @@ (Pointer (Call (Identifier) - (Empty)))))) + (Empty))) + (Complement + (Identifier))))) From e36799d4ef88c579bb587021527b890fa41cc69e Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 14:30:42 -0800 Subject: [PATCH 172/176] Assign function declarations with no body --- src/Language/Go/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index d43dffd66..3e2524bbc 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -463,7 +463,7 @@ expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment -functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) +functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> (block <|> emptyTerm)) <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') From d7573fc6c4cb375fb2771f72a61bc67af8706613 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 15:30:54 -0800 Subject: [PATCH 173/176] Create a types group --- src/Language/Go/Assignment.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index 3e2524bbc..a9c2e5e0f 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -204,6 +204,26 @@ expressions = mk <$> location <*> many expression mk _ [a] = a mk loc children = makeTerm loc children +types :: Assignment +types = arrayType + <|> channelType + <|> functionType + <|> implicitLengthArrayType + <|> interfaceType + <|> mapType + <|> parenthesizedType + <|> pointerType + <|> qualifiedType + <|> sliceType + <|> structType + <|> typeAssertion + <|> typeConversion + <|> typeDeclaration + <|> typeIdentifier + <|> typeCase + <|> typeCaseClause + <|> typeSwitchGuard + <|> typeSwitchStatement -- Literals From 77bdbdbb774d6b3caa4a9751f0419ffdf4cf74ce Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 15:32:46 -0800 Subject: [PATCH 174/176] Assign function declaration and function literals with optionals --- src/Language/Go/Assignment.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index a9c2e5e0f..b5685c3fc 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -483,10 +483,10 @@ expressionList :: Assignment expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment -functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> (block <|> emptyTerm)) - <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> many parameters <*> (expression <|> returnParameters <|> emptyTerm) <*> block) +functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> many parameters <*> optional (types <|> identifier <|> returnParameters) <*> optional block) + <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> many parameters <*> optional (types <|> identifier <|> returnParameters) <*> optional block) where - mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [types'] name' params' block') + mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [(maybe (makeTerm loc Syntax.Empty) id types')] name' params' (maybe (makeTerm loc Syntax.Empty) id block')) returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) variadicParameterDeclaration :: Assignment From b034e471faec94d18391aed6dc051b0dd35a82c1 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 15:33:07 -0800 Subject: [PATCH 175/176] Update function declaration tests --- test/fixtures/go/function-declarations.A.go | 1 + test/fixtures/go/function-declarations.B.go | 1 + test/fixtures/go/function-declarations.diffA-B.txt | 9 ++++++++- test/fixtures/go/function-declarations.diffB-A.txt | 12 +++++++++++- test/fixtures/go/function-declarations.parseA.txt | 7 ++++++- test/fixtures/go/function-declarations.parseB.txt | 7 ++++++- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/test/fixtures/go/function-declarations.A.go b/test/fixtures/go/function-declarations.A.go index 0acb03987..753a4cd8d 100644 --- a/test/fixtures/go/function-declarations.A.go +++ b/test/fixtures/go/function-declarations.A.go @@ -5,3 +5,4 @@ func f1() {} func f2(a int, b, c, d string) int {} func f2() (int, error) {} func f2() (result int, err error) {} +func lockedOSThread() bool diff --git a/test/fixtures/go/function-declarations.B.go b/test/fixtures/go/function-declarations.B.go index a20e14bfb..594b7c0fe 100644 --- a/test/fixtures/go/function-declarations.B.go +++ b/test/fixtures/go/function-declarations.B.go @@ -6,3 +6,4 @@ func fb(a int, b, c, d string) int {} func fc() (int, error) {} func fd() (result int, err error) {} func fe() () {;} +func lockOSThread() int diff --git a/test/fixtures/go/function-declarations.diffA-B.txt b/test/fixtures/go/function-declarations.diffA-B.txt index f249cd811..97888d677 100644 --- a/test/fixtures/go/function-declarations.diffA-B.txt +++ b/test/fixtures/go/function-declarations.diffA-B.txt @@ -54,4 +54,11 @@ {+([])+} {+([])+} {+(NoOp - {+(Empty)+})+})+}) + {+(Empty)+})+})+} + (Function + { (Identifier) + ->(Identifier) } + { (Identifier) + ->(Identifier) } + ([]) + (Empty))) diff --git a/test/fixtures/go/function-declarations.diffB-A.txt b/test/fixtures/go/function-declarations.diffB-A.txt index f918cd8e4..1375f79a3 100644 --- a/test/fixtures/go/function-declarations.diffB-A.txt +++ b/test/fixtures/go/function-declarations.diffB-A.txt @@ -48,10 +48,20 @@ (Identifier) (Identifier))) ([])) +{+(Function + {+(Identifier)+} + {+(Identifier)+} + {+([])+} + {+(Empty)+})+} {-(Function {-(Empty)-} {-(Identifier)-} {-([])-} {-([])-} {-(NoOp - {-(Empty)-})-})-}) + {-(Empty)-})-})-} +{-(Function + {-(Identifier)-} + {-(Identifier)-} + {-([])-} + {-(Empty)-})-}) diff --git a/test/fixtures/go/function-declarations.parseA.txt b/test/fixtures/go/function-declarations.parseA.txt index 8a0c2abfd..5a63bb35c 100644 --- a/test/fixtures/go/function-declarations.parseA.txt +++ b/test/fixtures/go/function-declarations.parseA.txt @@ -43,4 +43,9 @@ ( (Identifier) (Identifier))) - ([]))) + ([])) + (Function + (Identifier) + (Identifier) + ([]) + (Empty))) diff --git a/test/fixtures/go/function-declarations.parseB.txt b/test/fixtures/go/function-declarations.parseB.txt index 56a00305e..82e891101 100644 --- a/test/fixtures/go/function-declarations.parseB.txt +++ b/test/fixtures/go/function-declarations.parseB.txt @@ -50,4 +50,9 @@ ([]) ([]) (NoOp - (Empty)))) + (Empty))) + (Function + (Identifier) + (Identifier) + ([]) + (Empty))) From af63537d368126bcd48aa871f615da0496eea6b2 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 14 Nov 2017 15:35:48 -0800 Subject: [PATCH 176/176] Enforce function literals requiring a block --- src/Language/Go/Assignment.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index b5685c3fc..bbcb65c29 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -484,9 +484,10 @@ expressionList = symbol ExpressionList *> children expressions functionDeclaration :: Assignment functionDeclaration = mkTypedFunctionDeclaration <$> symbol FunctionDeclaration <*> children ((,,,) <$> expression <*> many parameters <*> optional (types <|> identifier <|> returnParameters) <*> optional block) - <|> mkTypedFunctionDeclaration <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> many parameters <*> optional (types <|> identifier <|> returnParameters) <*> optional block) + <|> mkTypedFunctionLiteral <$> symbol FuncLiteral <*> children ((,,,) <$> emptyTerm <*> many parameters <*> optional (types <|> identifier <|> returnParameters) <*> block) where mkTypedFunctionDeclaration loc (name', params', types', block') = makeTerm loc (Declaration.Function [(maybe (makeTerm loc Syntax.Empty) id types')] name' params' (maybe (makeTerm loc Syntax.Empty) id block')) + mkTypedFunctionLiteral loc (name', params', types', block') = makeTerm loc (Declaration.Function [(maybe (makeTerm loc Syntax.Empty) id types')] name' params' block') returnParameters = makeTerm <$> symbol Parameters <*> children (many expression) variadicParameterDeclaration :: Assignment