bug in parser for grouped qualifying types #921

Closed
gavinking opened this Issue Jan 29, 2014 · 3 comments

Comments

Projects
None yet
1 participant
Owner

gavinking commented Jan 29, 2014

The following does not even parse!

<Foo&Bar>.Baz something;

gavinking was assigned Jan 29, 2014

Owner

gavinking commented Jan 29, 2014

Hah. Interestingly, this is correct, according to the spec!

Owner

gavinking commented Jan 29, 2014

The following tiny patch fixes this, but is the syntactic predicate just hiding some deeper ambiguity?

diff --git a/Ceylon.g b/Ceylon.g
index 2ae0a4d..6caf76b 100644
--- a/Ceylon.g
+++ b/Ceylon.g
@@ -2539,8 +2539,6 @@ qualifiedOrTupleType returns [StaticType type]
       { $type=$tupleType.type; }
     | iterableType
       { $type=$iterableType.type; }
-    | groupedType
-      { $type=$groupedType.type; }
     ;

 /*typeAbbreviationStart
@@ -2594,12 +2592,17 @@ abbreviatedType returns [StaticType type]
     ;

 qualifiedType returns [SimpleType type]
-    : ot=typeNameWithArguments
+    : (
+      ot=typeNameWithArguments
       { BaseType bt = new BaseType(null);
         bt.setIdentifier($ot.identifier);
         if ($ot.typeArgumentList!=null)
             bt.setTypeArgumentList($ot.typeArgumentList);
         $type=bt; }
+      | 
+        groupedType
+        { $type=$groupedType.type; }
+      )
       (
         MEMBER_OP 
         it=typeNameWithArguments
@@ -2615,7 +2618,7 @@ qualifiedType returns [SimpleType type]
 typeNameWithArguments returns [Identifier identifier, TypeArgumentList typeArgumentList]
     : typeName
       { $identifier = $typeName.identifier; } 
-      (
+      ( (SMALLER_OP)=>
         typeArguments
         { $typeArgumentList = $typeArguments.typeArgumentList; }
       )?

@gavinking gavinking added a commit that referenced this issue Jan 29, 2014

@gavinking gavinking make grammar handle grouped types as qualifying types for #921
clean up grammar slightly
2a9f9fd

@gavinking gavinking added a commit that referenced this issue Jan 29, 2014

@gavinking gavinking update spec for #921 ae71613
Owner

gavinking commented Jan 29, 2014

Fixed.

gavinking closed this Jan 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment