diff --git a/tests/cases/checker/02_simple_operations.py.ref.json b/tests/cases/checker/02_simple_operations.py.ref.json index e3881e0..a2c5569 100644 --- a/tests/cases/checker/02_simple_operations.py.ref.json +++ b/tests/cases/checker/02_simple_operations.py.ref.json @@ -13,6 +13,20 @@ ] }, "message": "Cannot assign str to variable 'c' of type int" + }, + { + "type": "Error", + "location": { + "start": [ + 9, + 4 + ], + "end": [ + 9, + 9 + ] + }, + "message": "Undefined operation __add__ between bool and bool" } ], "judgments": [ @@ -158,9 +172,7 @@ "name": "d" } }, - "type": { - "name": "int" - } + "type": {} }, { "location": { diff --git a/tests/cases/checker/03_functions.py.ref.json b/tests/cases/checker/03_functions.py.ref.json index 3442bca..756a143 100644 --- a/tests/cases/checker/03_functions.py.ref.json +++ b/tests/cases/checker/03_functions.py.ref.json @@ -264,7 +264,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -328,7 +327,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -410,7 +408,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -509,7 +506,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -609,7 +605,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -725,7 +720,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -842,7 +836,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -924,7 +917,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -1006,7 +998,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -1123,7 +1114,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -1240,7 +1230,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, @@ -1357,7 +1346,6 @@ "name": "foo" }, "type": { - "name": "foo", "pos_args": [ { "pos": 0, diff --git a/tests/cases/checker/04_custom_types.midas b/tests/cases/checker/04_custom_types.midas index 6a1a6a2..ff4edb1 100644 --- a/tests/cases/checker/04_custom_types.midas +++ b/tests/cases/checker/04_custom_types.midas @@ -3,12 +3,12 @@ type Second = float type MeterPerSecond = float extend Meter { - op __add__(Meter) -> Meter - op __sub__(Meter) -> Meter - op __truediv__(Second) -> MeterPerSecond + def __add__: fn(Meter, /) -> Meter + def __sub__: fn(Meter, /) -> Meter + def __truediv__: fn(Second, /) -> MeterPerSecond } extend Second { - op __add__(Second) -> Second - op __sub__(Second) -> Second + def __add__: fn(Second, /) -> Second + def __sub__: fn(Second, /) -> Second } diff --git a/tests/cases/checker/06_subtyping.py b/tests/cases/checker/06_subtyping.py index c334ab8..7ab9dd7 100644 --- a/tests/cases/checker/06_subtyping.py +++ b/tests/cases/checker/06_subtyping.py @@ -9,4 +9,4 @@ def maximum(a: float, b: float): v3 = maximum(v1, v2) -v3 = v1 + v2 +v3 = v2 + v1 diff --git a/tests/cases/checker/06_subtyping.py.ref.json b/tests/cases/checker/06_subtyping.py.ref.json index 689402e..0659939 100644 --- a/tests/cases/checker/06_subtyping.py.ref.json +++ b/tests/cases/checker/06_subtyping.py.ref.json @@ -63,7 +63,6 @@ "name": "maximum" }, "type": { - "name": "maximum", "pos_args": [], "args": [ { @@ -149,10 +148,10 @@ }, "expr": { "_type": "VariableExpr", - "name": "v1" + "name": "v2" }, "type": { - "name": "int" + "name": "float" } }, { @@ -162,10 +161,10 @@ }, "expr": { "_type": "VariableExpr", - "name": "v2" + "name": "v1" }, "type": { - "name": "float" + "name": "int" } }, { @@ -177,12 +176,12 @@ "_type": "BinaryExpr", "left": { "_type": "VariableExpr", - "name": "v1" + "name": "v2" }, "operator": "+", "right": { "_type": "VariableExpr", - "name": "v2" + "name": "v1" } }, "type": { diff --git a/tests/cases/midas-parser/01_simple_types.midas b/tests/cases/midas-parser/01_simple_types.midas index 6446790..f0df3e2 100644 --- a/tests/cases/midas-parser/01_simple_types.midas +++ b/tests/cases/midas-parser/01_simple_types.midas @@ -10,8 +10,8 @@ type Difference[T] = T // Complex custom type, containing two values accessible through properties type GeoLocation = { - lat: Latitude - lon: Longitude + prop lat: Latitude + prop lon: Longitude } // Define operations on our custom type @@ -19,23 +19,23 @@ extend GeoLocation { // This type is compatible with the `-` operation with another GeoLocation // i.e. you can subtract a GeoLocation from another GeoLocation, resulting // in a Difference of GeoLocations - op __sub__(GeoLocation) -> Difference[GeoLocation] + def __sub__: fn(GeoLocation, /) -> Difference[GeoLocation] } // For complex generics, you need to specify how the genericity the properties // are handled type Difference[GeoLocation] = { - lat: Difference[Latitude] - lon: Difference[Longitude] + prop lat: Difference[Latitude] + prop lon: Difference[Longitude] } // Simple operation defined on our custom types extend Latitude { - op __sub__(Latitude) -> Difference[Latitude] + def __sub__: fn(Latitude, /) -> Difference[Latitude] } extend Longitude { - op __sub__(Longitude) -> Difference[Longitude] + def __sub__: fn(Longitude, /) -> Difference[Longitude] } // Predefined custom predicates that can be referenced in other definitions @@ -45,13 +45,13 @@ predicate Equatorial(loc: GeoLocation) = (-10 <= loc.lat <= 10) predicate Arctic(loc: GeoLocation) = (loc.lat >= 66) type Person = { - name: str + prop name: str // Property with an inline constraint - age: Optional[int where (0 <= _ < 150)] + prop age: Optional[int where (0 <= _ < 150)] // Property referencing a predicate - height: float where StrictlyPositive + prop height: float where StrictlyPositive - home: GeoLocation + prop home: GeoLocation } diff --git a/tests/cases/midas-parser/01_simple_types.midas.ref.json b/tests/cases/midas-parser/01_simple_types.midas.ref.json index 1d94718..be45687 100644 --- a/tests/cases/midas-parser/01_simple_types.midas.ref.json +++ b/tests/cases/midas-parser/01_simple_types.midas.ref.json @@ -511,17 +511,11 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "lat", + "type": "PROP", + "lexeme": "prop", "line": 13, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 13, - "column": 8 - }, { "type": "WHITESPACE", "lexeme": " ", @@ -530,15 +524,33 @@ }, { "type": "IDENTIFIER", - "lexeme": "Latitude", + "lexeme": "lat", "line": 13, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 13, + "column": 13 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 13, + "column": 14 + }, + { + "type": "IDENTIFIER", + "lexeme": "Latitude", + "line": 13, + "column": 15 + }, { "type": "NEWLINE", "lexeme": "\n", "line": 13, - "column": 18 + "column": 23 }, { "type": "WHITESPACE", @@ -547,17 +559,11 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "lon", + "type": "PROP", + "lexeme": "prop", "line": 14, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 14, - "column": 8 - }, { "type": "WHITESPACE", "lexeme": " ", @@ -566,15 +572,33 @@ }, { "type": "IDENTIFIER", - "lexeme": "Longitude", + "lexeme": "lon", "line": 14, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 14, + "column": 13 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 14, + "column": 14 + }, + { + "type": "IDENTIFIER", + "lexeme": "Longitude", + "line": 14, + "column": 15 + }, { "type": "NEWLINE", "lexeme": "\n", "line": 14, - "column": 19 + "column": 24 }, { "type": "RIGHT_BRACE", @@ -703,8 +727,8 @@ "column": 1 }, { - "type": "OP", - "lexeme": "op", + "type": "DEF", + "lexeme": "def", "line": 22, "column": 5 }, @@ -712,79 +736,115 @@ "type": "WHITESPACE", "lexeme": " ", "line": 22, - "column": 7 + "column": 8 }, { "type": "IDENTIFIER", "lexeme": "__sub__", "line": 22, - "column": 8 + "column": 9 + }, + { + "type": "COLON", + "lexeme": ":", + "line": 22, + "column": 16 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 22, + "column": 17 + }, + { + "type": "FUNC", + "lexeme": "fn", + "line": 22, + "column": 18 }, { "type": "LEFT_PAREN", "lexeme": "(", "line": 22, - "column": 15 + "column": 20 }, { "type": "IDENTIFIER", "lexeme": "GeoLocation", "line": 22, - "column": 16 + "column": 21 + }, + { + "type": "COMMA", + "lexeme": ",", + "line": 22, + "column": 32 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 22, + "column": 33 + }, + { + "type": "SLASH", + "lexeme": "/", + "line": 22, + "column": 34 }, { "type": "RIGHT_PAREN", "lexeme": ")", "line": 22, - "column": 27 + "column": 35 }, { "type": "WHITESPACE", "lexeme": " ", "line": 22, - "column": 28 + "column": 36 }, { "type": "ARROW", "lexeme": "->", "line": 22, - "column": 29 + "column": 37 }, { "type": "WHITESPACE", "lexeme": " ", "line": 22, - "column": 31 + "column": 39 }, { "type": "IDENTIFIER", "lexeme": "Difference", "line": 22, - "column": 32 + "column": 40 }, { "type": "LEFT_BRACKET", "lexeme": "[", "line": 22, - "column": 42 + "column": 50 }, { "type": "IDENTIFIER", "lexeme": "GeoLocation", "line": 22, - "column": 43 + "column": 51 }, { "type": "RIGHT_BRACKET", "lexeme": "]", "line": 22, - "column": 54 + "column": 62 }, { "type": "NEWLINE", "lexeme": "\n", "line": 22, - "column": 55 + "column": 63 }, { "type": "RIGHT_BRACE", @@ -901,17 +961,11 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "lat", + "type": "PROP", + "lexeme": "prop", "line": 28, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 28, - "column": 8 - }, { "type": "WHITESPACE", "lexeme": " ", @@ -920,33 +974,51 @@ }, { "type": "IDENTIFIER", - "lexeme": "Difference", + "lexeme": "lat", "line": 28, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 28, + "column": 13 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 28, + "column": 14 + }, + { + "type": "IDENTIFIER", + "lexeme": "Difference", + "line": 28, + "column": 15 + }, { "type": "LEFT_BRACKET", "lexeme": "[", "line": 28, - "column": 20 + "column": 25 }, { "type": "IDENTIFIER", "lexeme": "Latitude", "line": 28, - "column": 21 + "column": 26 }, { "type": "RIGHT_BRACKET", "lexeme": "]", "line": 28, - "column": 29 + "column": 34 }, { "type": "NEWLINE", "lexeme": "\n", "line": 28, - "column": 30 + "column": 35 }, { "type": "WHITESPACE", @@ -955,17 +1027,11 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "lon", + "type": "PROP", + "lexeme": "prop", "line": 29, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 29, - "column": 8 - }, { "type": "WHITESPACE", "lexeme": " ", @@ -974,33 +1040,51 @@ }, { "type": "IDENTIFIER", - "lexeme": "Difference", + "lexeme": "lon", "line": 29, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 29, + "column": 13 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 29, + "column": 14 + }, + { + "type": "IDENTIFIER", + "lexeme": "Difference", + "line": 29, + "column": 15 + }, { "type": "LEFT_BRACKET", "lexeme": "[", "line": 29, - "column": 20 + "column": 25 }, { "type": "IDENTIFIER", "lexeme": "Longitude", "line": 29, - "column": 21 + "column": 26 }, { "type": "RIGHT_BRACKET", "lexeme": "]", "line": 29, - "column": 30 + "column": 35 }, { "type": "NEWLINE", "lexeme": "\n", "line": 29, - "column": 31 + "column": 36 }, { "type": "RIGHT_BRACE", @@ -1075,8 +1159,8 @@ "column": 1 }, { - "type": "OP", - "lexeme": "op", + "type": "DEF", + "lexeme": "def", "line": 34, "column": 5 }, @@ -1084,79 +1168,115 @@ "type": "WHITESPACE", "lexeme": " ", "line": 34, - "column": 7 + "column": 8 }, { "type": "IDENTIFIER", "lexeme": "__sub__", "line": 34, - "column": 8 + "column": 9 + }, + { + "type": "COLON", + "lexeme": ":", + "line": 34, + "column": 16 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 34, + "column": 17 + }, + { + "type": "FUNC", + "lexeme": "fn", + "line": 34, + "column": 18 }, { "type": "LEFT_PAREN", "lexeme": "(", "line": 34, - "column": 15 + "column": 20 }, { "type": "IDENTIFIER", "lexeme": "Latitude", "line": 34, - "column": 16 + "column": 21 + }, + { + "type": "COMMA", + "lexeme": ",", + "line": 34, + "column": 29 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 34, + "column": 30 + }, + { + "type": "SLASH", + "lexeme": "/", + "line": 34, + "column": 31 }, { "type": "RIGHT_PAREN", "lexeme": ")", "line": 34, - "column": 24 + "column": 32 }, { "type": "WHITESPACE", "lexeme": " ", "line": 34, - "column": 25 + "column": 33 }, { "type": "ARROW", "lexeme": "->", "line": 34, - "column": 26 + "column": 34 }, { "type": "WHITESPACE", "lexeme": " ", "line": 34, - "column": 28 + "column": 36 }, { "type": "IDENTIFIER", "lexeme": "Difference", "line": 34, - "column": 29 + "column": 37 }, { "type": "LEFT_BRACKET", "lexeme": "[", "line": 34, - "column": 39 + "column": 47 }, { "type": "IDENTIFIER", "lexeme": "Latitude", "line": 34, - "column": 40 + "column": 48 }, { "type": "RIGHT_BRACKET", "lexeme": "]", "line": 34, - "column": 48 + "column": 56 }, { "type": "NEWLINE", "lexeme": "\n", "line": 34, - "column": 49 + "column": 57 }, { "type": "RIGHT_BRACE", @@ -1219,8 +1339,8 @@ "column": 1 }, { - "type": "OP", - "lexeme": "op", + "type": "DEF", + "lexeme": "def", "line": 38, "column": 5 }, @@ -1228,79 +1348,115 @@ "type": "WHITESPACE", "lexeme": " ", "line": 38, - "column": 7 + "column": 8 }, { "type": "IDENTIFIER", "lexeme": "__sub__", "line": 38, - "column": 8 + "column": 9 + }, + { + "type": "COLON", + "lexeme": ":", + "line": 38, + "column": 16 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 38, + "column": 17 + }, + { + "type": "FUNC", + "lexeme": "fn", + "line": 38, + "column": 18 }, { "type": "LEFT_PAREN", "lexeme": "(", "line": 38, - "column": 15 + "column": 20 }, { "type": "IDENTIFIER", "lexeme": "Longitude", "line": 38, - "column": 16 + "column": 21 + }, + { + "type": "COMMA", + "lexeme": ",", + "line": 38, + "column": 30 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 38, + "column": 31 + }, + { + "type": "SLASH", + "lexeme": "/", + "line": 38, + "column": 32 }, { "type": "RIGHT_PAREN", "lexeme": ")", "line": 38, - "column": 25 + "column": 33 }, { "type": "WHITESPACE", "lexeme": " ", "line": 38, - "column": 26 + "column": 34 }, { "type": "ARROW", "lexeme": "->", "line": 38, - "column": 27 + "column": 35 }, { "type": "WHITESPACE", "lexeme": " ", "line": 38, - "column": 29 + "column": 37 }, { "type": "IDENTIFIER", "lexeme": "Difference", "line": 38, - "column": 30 + "column": 38 }, { "type": "LEFT_BRACKET", "lexeme": "[", "line": 38, - "column": 40 + "column": 48 }, { "type": "IDENTIFIER", "lexeme": "Longitude", "line": 38, - "column": 41 + "column": 49 }, { "type": "RIGHT_BRACKET", "lexeme": "]", "line": 38, - "column": 50 + "column": 58 }, { "type": "NEWLINE", "lexeme": "\n", "line": 38, - "column": 51 + "column": 59 }, { "type": "RIGHT_BRACE", @@ -1903,34 +2059,46 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "name", + "type": "PROP", + "lexeme": "prop", "line": 48, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 48, - "column": 9 - }, { "type": "WHITESPACE", "lexeme": " ", "line": 48, + "column": 9 + }, + { + "type": "IDENTIFIER", + "lexeme": "name", + "line": 48, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 48, + "column": 14 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 48, + "column": 15 + }, { "type": "IDENTIFIER", "lexeme": "str", "line": 48, - "column": 11 + "column": 16 }, { "type": "NEWLINE", "lexeme": "\n", "line": 48, - "column": 14 + "column": 19 }, { "type": "NEWLINE", @@ -1963,17 +2131,11 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "age", + "type": "PROP", + "lexeme": "prop", "line": 51, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 51, - "column": 8 - }, { "type": "WHITESPACE", "lexeme": " ", @@ -1982,74 +2144,68 @@ }, { "type": "IDENTIFIER", - "lexeme": "Optional", + "lexeme": "age", "line": 51, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 51, + "column": 13 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 51, + "column": 14 + }, + { + "type": "IDENTIFIER", + "lexeme": "Optional", + "line": 51, + "column": 15 + }, { "type": "LEFT_BRACKET", "lexeme": "[", "line": 51, - "column": 18 + "column": 23 }, { "type": "IDENTIFIER", "lexeme": "int", "line": 51, - "column": 19 + "column": 24 }, { "type": "WHITESPACE", "lexeme": " ", "line": 51, - "column": 22 + "column": 27 }, { "type": "WHERE", "lexeme": "where", "line": 51, - "column": 23 + "column": 28 }, { "type": "WHITESPACE", "lexeme": " ", "line": 51, - "column": 28 + "column": 33 }, { "type": "LEFT_PAREN", "lexeme": "(", "line": 51, - "column": 29 + "column": 34 }, { "type": "NUMBER", "lexeme": "0", "line": 51, - "column": 30 - }, - { - "type": "WHITESPACE", - "lexeme": " ", - "line": 51, - "column": 31 - }, - { - "type": "LESS_EQUAL", - "lexeme": "<=", - "line": 51, - "column": 32 - }, - { - "type": "WHITESPACE", - "lexeme": " ", - "line": 51, - "column": 34 - }, - { - "type": "UNDERSCORE", - "lexeme": "_", - "line": 51, "column": 35 }, { @@ -2059,8 +2215,8 @@ "column": 36 }, { - "type": "LESS", - "lexeme": "<", + "type": "LESS_EQUAL", + "lexeme": "<=", "line": 51, "column": 37 }, @@ -2068,31 +2224,55 @@ "type": "WHITESPACE", "lexeme": " ", "line": 51, - "column": 38 + "column": 39 + }, + { + "type": "UNDERSCORE", + "lexeme": "_", + "line": 51, + "column": 40 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 51, + "column": 41 + }, + { + "type": "LESS", + "lexeme": "<", + "line": 51, + "column": 42 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 51, + "column": 43 }, { "type": "NUMBER", "lexeme": "150", "line": 51, - "column": 39 + "column": 44 }, { "type": "RIGHT_PAREN", "lexeme": ")", "line": 51, - "column": 42 + "column": 47 }, { "type": "RIGHT_BRACKET", "lexeme": "]", "line": 51, - "column": 43 + "column": 48 }, { "type": "NEWLINE", "lexeme": "\n", "line": 51, - "column": 44 + "column": 49 }, { "type": "NEWLINE", @@ -2124,59 +2304,71 @@ "line": 54, "column": 1 }, + { + "type": "PROP", + "lexeme": "prop", + "line": 54, + "column": 5 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 54, + "column": 9 + }, { "type": "IDENTIFIER", "lexeme": "height", "line": 54, - "column": 5 + "column": 10 }, { "type": "COLON", "lexeme": ":", "line": 54, - "column": 11 + "column": 16 }, { "type": "WHITESPACE", "lexeme": " ", "line": 54, - "column": 12 + "column": 17 }, { "type": "IDENTIFIER", "lexeme": "float", "line": 54, - "column": 13 + "column": 18 }, { "type": "WHITESPACE", "lexeme": " ", "line": 54, - "column": 18 + "column": 23 }, { "type": "WHERE", "lexeme": "where", "line": 54, - "column": 19 + "column": 24 }, { "type": "WHITESPACE", "lexeme": " ", "line": 54, - "column": 24 + "column": 29 }, { "type": "IDENTIFIER", "lexeme": "StrictlyPositive", "line": 54, - "column": 25 + "column": 30 }, { "type": "NEWLINE", "lexeme": "\n", "line": 54, - "column": 41 + "column": 46 }, { "type": "NEWLINE", @@ -2191,34 +2383,46 @@ "column": 1 }, { - "type": "IDENTIFIER", - "lexeme": "home", + "type": "PROP", + "lexeme": "prop", "line": 56, "column": 5 }, - { - "type": "COLON", - "lexeme": ":", - "line": 56, - "column": 9 - }, { "type": "WHITESPACE", "lexeme": " ", "line": 56, + "column": 9 + }, + { + "type": "IDENTIFIER", + "lexeme": "home", + "line": 56, "column": 10 }, + { + "type": "COLON", + "lexeme": ":", + "line": 56, + "column": 14 + }, + { + "type": "WHITESPACE", + "lexeme": " ", + "line": 56, + "column": 15 + }, { "type": "IDENTIFIER", "lexeme": "GeoLocation", "line": 56, - "column": 11 + "column": 16 }, { "type": "NEWLINE", "lexeme": "\n", "line": 56, - "column": 22 + "column": 27 }, { "type": "RIGHT_BRACE", @@ -2345,9 +2549,10 @@ "params": [], "type": { "_type": "ComplexType", - "properties": [ + "members": [ { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "lat", "type": { "_type": "NamedType", @@ -2355,7 +2560,8 @@ } }, { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "lon", "type": { "_type": "NamedType", @@ -2367,30 +2573,40 @@ }, { "_type": "ExtendStmt", - "type": { - "_type": "NamedType", - "name": "GeoLocation" - }, - "operations": [ + "name": "GeoLocation", + "params": [], + "members": [ { - "_type": "OpStmt", + "_type": "MemberStmt", + "kind": "METHOD", "name": "__sub__", - "operand": { - "_type": "NamedType", - "name": "GeoLocation" - }, - "result": { - "_type": "GenericType", - "type": { - "_type": "NamedType", - "name": "Difference" - }, - "args": [ + "type": { + "_type": "FunctionType", + "pos_args": [ { - "_type": "NamedType", - "name": "GeoLocation" + "name": null, + "type": { + "_type": "NamedType", + "name": "GeoLocation" + }, + "required": true } - ] + ], + "args": [], + "kw_args": [], + "returns": { + "_type": "GenericType", + "type": { + "_type": "NamedType", + "name": "Difference" + }, + "args": [ + { + "_type": "NamedType", + "name": "GeoLocation" + } + ] + } } } ] @@ -2406,9 +2622,10 @@ ], "type": { "_type": "ComplexType", - "properties": [ + "members": [ { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "lat", "type": { "_type": "GenericType", @@ -2425,7 +2642,8 @@ } }, { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "lon", "type": { "_type": "GenericType", @@ -2446,60 +2664,80 @@ }, { "_type": "ExtendStmt", - "type": { - "_type": "NamedType", - "name": "Latitude" - }, - "operations": [ + "name": "Latitude", + "params": [], + "members": [ { - "_type": "OpStmt", + "_type": "MemberStmt", + "kind": "METHOD", "name": "__sub__", - "operand": { - "_type": "NamedType", - "name": "Latitude" - }, - "result": { - "_type": "GenericType", - "type": { - "_type": "NamedType", - "name": "Difference" - }, - "args": [ + "type": { + "_type": "FunctionType", + "pos_args": [ { - "_type": "NamedType", - "name": "Latitude" + "name": null, + "type": { + "_type": "NamedType", + "name": "Latitude" + }, + "required": true } - ] + ], + "args": [], + "kw_args": [], + "returns": { + "_type": "GenericType", + "type": { + "_type": "NamedType", + "name": "Difference" + }, + "args": [ + { + "_type": "NamedType", + "name": "Latitude" + } + ] + } } } ] }, { "_type": "ExtendStmt", - "type": { - "_type": "NamedType", - "name": "Longitude" - }, - "operations": [ + "name": "Longitude", + "params": [], + "members": [ { - "_type": "OpStmt", + "_type": "MemberStmt", + "kind": "METHOD", "name": "__sub__", - "operand": { - "_type": "NamedType", - "name": "Longitude" - }, - "result": { - "_type": "GenericType", - "type": { - "_type": "NamedType", - "name": "Difference" - }, - "args": [ + "type": { + "_type": "FunctionType", + "pos_args": [ { - "_type": "NamedType", - "name": "Longitude" + "name": null, + "type": { + "_type": "NamedType", + "name": "Longitude" + }, + "required": true } - ] + ], + "args": [], + "kw_args": [], + "returns": { + "_type": "GenericType", + "type": { + "_type": "NamedType", + "name": "Difference" + }, + "args": [ + { + "_type": "NamedType", + "name": "Longitude" + } + ] + } } } ] @@ -2620,9 +2858,10 @@ "params": [], "type": { "_type": "ComplexType", - "properties": [ + "members": [ { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "name", "type": { "_type": "NamedType", @@ -2630,7 +2869,8 @@ } }, { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "age", "type": { "_type": "GenericType", @@ -2672,7 +2912,8 @@ } }, { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "height", "type": { "_type": "ConstraintType", @@ -2687,7 +2928,8 @@ } }, { - "_type": "PropertyStmt", + "_type": "MemberStmt", + "kind": "PROPERTY", "name": "home", "type": { "_type": "NamedType",