Skip to content

Support type annotations#946

Merged
vladmos merged 2 commits intobazelbuild:masterfrom
vladmos:type_annotations
Feb 3, 2021
Merged

Support type annotations#946
vladmos merged 2 commits intobazelbuild:masterfrom
vladmos:type_annotations

Conversation

@vladmos
Copy link
Member

@vladmos vladmos commented Jan 29, 2021

The commit allows using Python3-like type annotations for function parameters and return values:

def f(x: int, y: str) -> List[bool]:
    pass

Fixes #900

@vladmos vladmos merged commit 9c80db6 into bazelbuild:master Feb 3, 2021
@vladmos vladmos deleted the type_annotations branch February 3, 2021 11:29
@sluongng
Copy link

sluongng commented Feb 4, 2021

Is this syntax compatible with Bazel?

I take it that here Type annotation can be parsed, but is not strongly enforced/checked right?

@vladmos
Copy link
Member Author

vladmos commented Feb 4, 2021

Correct, Bazel currently doesn't support type annotations, and Buildifier doesn't enforce them in any way, this is just for compatibility with other Starlark dialects that use Python3-like type annotations.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support type annotations

3 participants