-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] Build lists using a primitive op #10807
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
Changes from all commits
3e7a562
ac96099
78820e2
22dc25e
1ab6915
a79f98e
a47ec79
d66f7a0
b81bc92
101b2a6
c25232b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,30 @@ L0: | |
x = r0 | ||
return 1 | ||
|
||
[case testNewListTenItems] | ||
from typing import List | ||
def f() -> None: | ||
x: List[str] = ['a', 'b', 'c', 'd', 'e', | ||
'f', 'g', 'h', 'i', 'j'] | ||
[out] | ||
def f(): | ||
r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 :: str | ||
r10, x :: list | ||
L0: | ||
r0 = 'a' | ||
r1 = 'b' | ||
r2 = 'c' | ||
r3 = 'd' | ||
r4 = 'e' | ||
r5 = 'f' | ||
r6 = 'g' | ||
r7 = 'h' | ||
r8 = 'i' | ||
r9 = 'j' | ||
r10 = CPyList_Build(10, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9) | ||
x = r10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have IR tests for both short and long list literals? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have dozens of list building cases, whose length is less than 10, in other irbuilding tests. So I think we only need one more test for building a 10 items list. |
||
return 1 | ||
|
||
[case testListMultiply] | ||
from typing import List | ||
def f(a: List[int]) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
make_list
a good name? since we have anothernew_list_op_with_length
for creating empty list.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ummm, I saw we have different namings now like
make_dict
andnew_set_op
, I think we should adopt one and stick to it, likemake_xxx
ornew_xxx_op
but not both.