-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from Glyphack/type-alias
- Loading branch information
Showing
7 changed files
with
186 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Show me some examples of type aliasing in Python try to give examples for all | ||
|
||
type Alias1 = int | ||
type Alias2 = str | ||
type Alias3 = float | ||
|
||
type AliasToAnotherAlias = Alias1 |
125 changes: 125 additions & 0 deletions
125
...estdata/output/enderpy_python_type_checker__build__tests__symbol_table@type_alias.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
source: typechecker/src/build.rs | ||
description: "# Show me some examples of type aliasing in Python try to give examples for all\n\ntype Alias1 = int\ntype Alias2 = str\ntype Alias3 = float\n\ntype AliasToAnotherAlias = Alias1\n" | ||
expression: result | ||
input_file: typechecker/test_data/inputs/symbol_table/type_alias.py | ||
--- | ||
------------------- | ||
global scope: | ||
Symbols: | ||
Alias1 | ||
- Declarations: | ||
--: TypeAlias { | ||
declaration_path: DeclarationPath { | ||
module_name: [REDACTED]", | ||
node: Node { | ||
start: 81, | ||
end: 98, | ||
}, | ||
}, | ||
type_alias_node: TypeAlias { | ||
node: Node { | ||
start: 81, | ||
end: 98, | ||
}, | ||
name: "Alias1", | ||
type_params: [], | ||
value: Name( | ||
Name { | ||
node: Node { | ||
start: 95, | ||
end: 98, | ||
}, | ||
id: "int", | ||
}, | ||
), | ||
}, | ||
} | ||
Alias2 | ||
- Declarations: | ||
--: TypeAlias { | ||
declaration_path: DeclarationPath { | ||
module_name: [REDACTED]", | ||
node: Node { | ||
start: 99, | ||
end: 116, | ||
}, | ||
}, | ||
type_alias_node: TypeAlias { | ||
node: Node { | ||
start: 99, | ||
end: 116, | ||
}, | ||
name: "Alias2", | ||
type_params: [], | ||
value: Name( | ||
Name { | ||
node: Node { | ||
start: 113, | ||
end: 116, | ||
}, | ||
id: "str", | ||
}, | ||
), | ||
}, | ||
} | ||
Alias3 | ||
- Declarations: | ||
--: TypeAlias { | ||
declaration_path: DeclarationPath { | ||
module_name: [REDACTED]", | ||
node: Node { | ||
start: 117, | ||
end: 136, | ||
}, | ||
}, | ||
type_alias_node: TypeAlias { | ||
node: Node { | ||
start: 117, | ||
end: 136, | ||
}, | ||
name: "Alias3", | ||
type_params: [], | ||
value: Name( | ||
Name { | ||
node: Node { | ||
start: 131, | ||
end: 136, | ||
}, | ||
id: "float", | ||
}, | ||
), | ||
}, | ||
} | ||
AliasToAnotherAlias | ||
- Declarations: | ||
--: TypeAlias { | ||
declaration_path: DeclarationPath { | ||
module_name: [REDACTED]", | ||
node: Node { | ||
start: 138, | ||
end: 171, | ||
}, | ||
}, | ||
type_alias_node: TypeAlias { | ||
node: Node { | ||
start: 138, | ||
end: 171, | ||
}, | ||
name: "AliasToAnotherAlias", | ||
type_params: [], | ||
value: Name( | ||
Name { | ||
node: Node { | ||
start: 165, | ||
end: 171, | ||
}, | ||
id: "Alias1", | ||
}, | ||
), | ||
}, | ||
} | ||
|
||
all scopes: | ||
------------------- | ||
|