Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JIT] Resolve string literal type annotations using Resolver::resolveType #47731

Closed

Conversation

SplitInfinity
Copy link

@SplitInfinity SplitInfinity commented Nov 11, 2020

Stack from ghstack:

Summary
This commit modifies ScriptTypeParser::parseTypeFromExpr so that
string literal type annotations are resolved using
Resolver::resolveType. At present, they are parsed in
parseBaseTypeName, which inadvertently allows any key from
string_to_type_lut to be used as a string literal type annotation.

Test Plan
Existing unit tests (most notably
TestClassType.test_self_referential_method which tests the main
feature, self-referential class type annotations, that make use of
string literal type annotations).

Fixes
This commit fixes #47570.

Differential Revision: D24934717

…eType`

**Summary**
This commit modifies `ScriptTypeParser::parseTypeFromExpr` so that
string literal type annotations are resolved using
`Resolver::resolveType`. At present, they are parsed in
`parseBaseTypeName`, which inadvertently allows any key from
`string_to_type_lut` to be used as a string literal type annotation.

**Test Plan**
Existing unit tests (most notably
`TestClassType.test_self_referential_method` which tests the main
feature, self-referential class type annotations, that make use of
string literal type annotations).

**Fixes**
This commit fixes #47570.

[ghstack-poisoned]
@facebook-github-bot facebook-github-bot added cla signed oncall: jit Add this issue/PR to JIT oncall triage queue labels Nov 11, 2020
SplitInfinity pushed a commit that referenced this pull request Nov 11, 2020
…eType`

**Summary**
This commit modifies `ScriptTypeParser::parseTypeFromExpr` so that
string literal type annotations are resolved using
`Resolver::resolveType`. At present, they are parsed in
`parseBaseTypeName`, which inadvertently allows any key from
`string_to_type_lut` to be used as a string literal type annotation.

**Test Plan**
Existing unit tests (most notably
`TestClassType.test_self_referential_method` which tests the main
feature, self-referential class type annotations, that make use of
string literal type annotations).

**Fixes**
This commit fixes #47570.

ghstack-source-id: 9e5a2c83f6211084a378df1863e662e2ced936ce
Pull Request resolved: #47731
@dr-ci
Copy link

dr-ci bot commented Nov 11, 2020

💊 CI failures summary and remediations

As of commit 0eac8d4 (more details on the Dr. CI page):


  • 1/1 failures introduced in this PR

1 failure not recognized by patterns:

Job Step Action
CircleCI docker-pytorch-linux-bionic-cuda11.0-cudnn8-py3.6-gcc9 Check if image should be built 🔁 rerun

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 11 times.

…ver::resolveType`"

**Summary**
This commit modifies `ScriptTypeParser::parseTypeFromExpr` so that
string literal type annotations are resolved using
`Resolver::resolveType`. At present, they are parsed in
`parseBaseTypeName`, which inadvertently allows any key from
`string_to_type_lut` to be used as a string literal type annotation.

**Test Plan**
Existing unit tests (most notably
`TestClassType.test_self_referential_method` which tests the main
feature, self-referential class type annotations, that make use of
string literal type annotations).

**Fixes**
This commit fixes #47570.

[ghstack-poisoned]
SplitInfinity pushed a commit that referenced this pull request Nov 12, 2020
…eType`

**Summary**
This commit modifies `ScriptTypeParser::parseTypeFromExpr` so that
string literal type annotations are resolved using
`Resolver::resolveType`. At present, they are parsed in
`parseBaseTypeName`, which inadvertently allows any key from
`string_to_type_lut` to be used as a string literal type annotation.

**Test Plan**
Existing unit tests (most notably
`TestClassType.test_self_referential_method` which tests the main
feature, self-referential class type annotations, that make use of
string literal type annotations).

**Fixes**
This commit fixes #47570.

ghstack-source-id: 6323420f3446f75269e5d664450ee14be493b8f3
Pull Request resolved: #47731
@jeffdaily
Copy link
Collaborator

ROCm CI failure due to CI script update. Will retest.

@jeffdaily
Copy link
Collaborator

@pytorchbot retest this please

@facebook-github-bot
Copy link
Contributor

@SplitInfinity merged this pull request in 03d1978.

@facebook-github-bot
Copy link
Contributor

@SplitInfinity merged this pull request in 03d1978.

@ppwwyyxx
Copy link
Contributor

Oops I thought supporting "Device" in #47570 is a feature, not bug 😆
Now the problem is, with this "feature" removed, and because of #47405, we can no longer annotate a method that uses device type in argument. So it actually causes a regression.

@SplitInfinity
Copy link
Author

SplitInfinity commented Nov 14, 2020

I fixed #47405 in #47734 - does that help?

@ppwwyyxx
Copy link
Contributor

That's great! Didn't notice this fix is also coming

tugsbayasgalan pushed a commit to tugsbayasgalan/pytorch that referenced this pull request Nov 16, 2020
…eType` (pytorch#47731)

Summary:
Pull Request resolved: pytorch#47731

**Summary**
This commit modifies `ScriptTypeParser::parseTypeFromExpr` so that
string literal type annotations are resolved using
`Resolver::resolveType`. At present, they are parsed in
`parseBaseTypeName`, which inadvertently allows any key from
`string_to_type_lut` to be used as a string literal type annotation.

**Test Plan**
Existing unit tests (most notably
`TestClassType.test_self_referential_method` which tests the main
feature, self-referential class type annotations, that make use of
string literal type annotations).

**Fixes**
This commit fixes pytorch#47570.

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D24934717

Pulled By: SplitInfinity

fbshipit-source-id: b915b2c08272566b63b3cf5ff4a07ad43bdc381a
@facebook-github-bot facebook-github-bot deleted the gh/splitinfinity/65/head branch November 17, 2020 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants