Repository: edgedb/edgedb

Issue:
Can't make View example work
Hi, I'm working through the tutorial example of Movie and Person types and trying to incorporate a View example into it. 

These are my types with relevant properties and links:

```
  type Movie {
    required property title -> str;
    multi link cast -> Person; 
  }
  type Person {
    property first_name -> str;
    required property last_name -> str;
    property name :=
      .first_name ++ ' ' ++ .last_name
      IF EXISTS .first_name
      ELSE .last_name;
  }
  view PersonView := Person {
    stars_in := Person.<cast[IS Movie]
  }
```
When I run the following query, I get an **`Unexpected {`** error. 
```
SELECT PersonView { 
  stars_in {
    title 
  } 
} FILTER .name = 'Ryan Gosling';
```

However, when I run the query without destructuring the Movie type, I am able to get the `id` object of the movies:
```
SELECT PersonView { 
  stars_in 
} FILTER .name = 'Ryan Gosling';
```

Am I missing some obvious way to declare the shape of the Movie in the PersonView? Thanks for your help!

PS: I am able to get what I want by using the following query, but leaving the issue open in case you can help with the above regardless.
```
SELECT Person {
    name,
    stars_in := (SELECT
        Person.<cast[IS Movie] {
            title
        }
    )
}
FILTER Person.name = 'Ryan Gosling';
```


Discussion:
You have missed a colon in your first query, it should read:

```
SELECT PersonView { 
  stars_in: {
    title 
  } 
} FILTER .name = 'Ryan Gosling';
```
@vpetrovykh Can we have a better error message for this case? Essentially add another production `ShapeElement_BRACE` which would error out suggesting how to fix this?

Resolving patch:
diff --git a/edb/edgeql/parser/grammar/expressions.py b/edb/edgeql/parser/grammar/expressions.py
--- a/edb/edgeql/parser/grammar/expressions.py
+++ b/edb/edgeql/parser/grammar/expressions.py
@@ -296,6 +296,16 @@ def reduce_COLON_TypedShape(self, *kids):
         )]
         self.val += shape.elements
 
+    def reduce_LBRACE(self, *kids):
+        raise EdgeQLSyntaxError(
+            f"Missing ':' before '{{' in a sub-shape",
+            context=kids[0].context)
+
+    def reduce_Shape(self, *kids):
+        raise EdgeQLSyntaxError(
+            f"Missing ':' before '{{' in a sub-shape",
+            context=kids[0].context)
+
     def reduce_empty(self, *kids):
         self.val = None
 


Test patch:
diff --git a/tests/test_edgeql_syntax.py b/tests/test_edgeql_syntax.py
--- a/tests/test_edgeql_syntax.py
+++ b/tests/test_edgeql_syntax.py
@@ -1360,6 +1360,26 @@ def test_edgeql_syntax_shape_44(self):
         };
         """
 
+    @tb.must_fail(errors.EdgeQLSyntaxError,
+                  r"Missing ':' before '{'", line=3, col=17)
+    def test_edgeql_syntax_shape_45(self):
+        """
+        SELECT Foo {
+            foo {}
+        };
+        """
+
+    @tb.must_fail(errors.EdgeQLSyntaxError,
+                  r"Missing ':' before '{'", line=3, col=17)
+    def test_edgeql_syntax_shape_46(self):
+        """
+        SELECT Foo {
+            foo {
+                bar
+            }
+        };
+        """
+
     def test_edgeql_syntax_struct_01(self):
         """
         SELECT (