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

List refactoring (v6) #8773

Closed
wants to merge 114 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
5b33589
Fix array_merge argument unpacking
danog Nov 20, 2022
cc4461f
Progress
danog Nov 20, 2022
3f5f98b
Refactoring
danog Nov 21, 2022
98bfe9f
Add note for 5.1 BC break
danog Nov 21, 2022
f7527d4
Fix
danog Nov 21, 2022
b632871
Remove getGenericArrayType parameter right away, and do not return a …
danog Nov 21, 2022
5797945
Skip test
danog Nov 21, 2022
7683a48
Revert
danog Nov 21, 2022
03c53d7
Deprecate TList and TNonEmptyList
danog Nov 21, 2022
80eab1b
Update
danog Nov 21, 2022
0a3971a
Deprecate TCallableList as well
danog Nov 21, 2022
5bf226d
Cleanup
danog Nov 21, 2022
bd9b77d
Cleanup
danog Nov 21, 2022
0345254
Reuse code
danog Nov 21, 2022
61a595b
Cleanup
danog Nov 21, 2022
9a5337d
Switch to Type::getListAtomic
danog Nov 22, 2022
d580181
Finalize
danog Nov 22, 2022
1a9edc3
Fix cs
danog Nov 22, 2022
4ceb562
Merge branch 'list_bc_break' into tnon_empty_list_refactoring
danog Nov 26, 2022
3154860
Cleanup
danog Nov 26, 2022
cf3a49a
Cleanup
danog Nov 26, 2022
d2e0d31
Cleanup
danog Nov 26, 2022
ab1a901
Cleanup
danog Nov 26, 2022
5b12042
Cleanup
danog Nov 26, 2022
b43207e
Cleanup
danog Nov 26, 2022
415d103
Cleanup
danog Nov 26, 2022
61cce1b
Cleanup
danog Nov 26, 2022
668afa9
Cleanup
danog Nov 26, 2022
956fa44
Cleanup
danog Nov 26, 2022
fca60dc
Cleanup
danog Nov 26, 2022
864a764
Cleanup
danog Nov 26, 2022
120ba1f
Refactoring
danog Nov 26, 2022
0a20c10
Refactoring
danog Nov 26, 2022
e2da9c9
Cleanup
danog Nov 26, 2022
3f710a8
Cleanup
danog Nov 26, 2022
546f2b3
Cleanup
danog Nov 26, 2022
51e6b11
Cleanup
danog Nov 26, 2022
700e066
Fixes
danog Nov 26, 2022
1c32a22
Fix
danog Nov 26, 2022
c823c87
Cleanup
danog Nov 26, 2022
45c26d0
Merge remote-tracking branch 'origin/master' into tnon_empty_list_ref…
danog Nov 26, 2022
d0d7c46
Fix
danog Nov 26, 2022
0f99365
Cleanup
danog Nov 26, 2022
a964715
Update
danog Nov 26, 2022
582a785
Fix
danog Nov 26, 2022
34825fc
Fix
danog Nov 26, 2022
156d629
Fix
danog Nov 26, 2022
a342a26
Fix
danog Nov 26, 2022
99bdc2f
Cleanup
danog Nov 26, 2022
65f849a
Cleanup
danog Nov 26, 2022
95e0614
Off-by-one fun
danog Nov 26, 2022
65886c9
Fixes
danog Nov 26, 2022
c0b0dbc
Fix bug
danog Nov 26, 2022
3178836
Fixes
danog Nov 26, 2022
e7f2fdd
Fix
danog Nov 26, 2022
e89609b
Fixes
danog Nov 26, 2022
0107a34
Cleanup logic
danog Nov 26, 2022
abbaf88
Improve assertions
danog Nov 26, 2022
a6a6595
Fix
danog Nov 26, 2022
4f10cd3
Cleanup
danog Nov 26, 2022
9a0ecf7
Fixes
danog Nov 26, 2022
909edb4
Fixes
danog Nov 27, 2022
2b9512e
Generate properly shaped lists when appending
danog Nov 27, 2022
0542b0e
Fix list templates
danog Nov 27, 2022
163330c
Merge remote-tracking branch 'o/master' into tnon_empty_list_refactoring
danog Nov 27, 2022
389c6e6
Revert weird legacy logic
danog Nov 27, 2022
0bb70b3
Update
danog Nov 27, 2022
8a4ba6d
Cleanup
danog Nov 28, 2022
c156807
Update
danog Nov 28, 2022
42380db
Cleanup
danog Nov 28, 2022
e821109
Fixes
danog Nov 29, 2022
2b0e979
Fixes
danog Nov 29, 2022
d24a243
Fix
danog Dec 1, 2022
8fc161c
Merge remote-tracking branch 'origin/master' into tnon_empty_list_ref…
danog Dec 1, 2022
6c3ffa2
Fix logic
danog Dec 1, 2022
03fc544
Fix
danog Dec 1, 2022
e529402
Fix
danog Dec 1, 2022
412d3c9
Simplify
danog Dec 1, 2022
e50b351
Cleanup
danog Dec 2, 2022
f89a3c9
Fix
danog Dec 2, 2022
54600ca
Fixup
danog Dec 2, 2022
4bf7087
Fixes
danog Dec 2, 2022
7e571f4
Fixes
danog Dec 2, 2022
b8ffb31
Possible fix
danog Dec 2, 2022
096b390
Cleanup
danog Dec 2, 2022
a0bf4cf
Fixes
danog Dec 2, 2022
8aecadd
Fixes
danog Dec 2, 2022
dead1be
Fix
danog Dec 2, 2022
c96a44d
Revert
danog Dec 2, 2022
a5df566
Fixes
danog Dec 2, 2022
b07aba9
Fix
danog Dec 2, 2022
e628c7b
Fixes
danog Dec 2, 2022
f015c50
Fixes
danog Dec 2, 2022
4847165
Fixes
danog Dec 2, 2022
c894b89
Fixes
danog Dec 2, 2022
550a7aa
Fixes
danog Dec 2, 2022
8f2a8c0
Fixes
danog Dec 2, 2022
d4df856
Cleanup
danog Dec 2, 2022
c802213
Fixes
danog Dec 2, 2022
59ab73f
Fixes
danog Dec 2, 2022
5f291af
Fixes
danog Dec 2, 2022
c05ce2d
Fixes
danog Dec 2, 2022
709324b
Fixes
danog Dec 2, 2022
4a77e83
Fix
danog Dec 2, 2022
c4c3016
Fix
danog Dec 2, 2022
abe722d
Fix array_key_exists with constants
danog Dec 2, 2022
23b0ac0
Hack
danog Dec 2, 2022
55edadc
Merge remote-tracking branch 'origin/master' into tnon_empty_list_ref…
danog Dec 2, 2022
78d64e3
Fix
danog Dec 2, 2022
3ce782f
Fixes
danog Dec 2, 2022
c24e6a9
Fix
danog Dec 2, 2022
4c47d50
Update
danog Dec 2, 2022
a154d96
Keep HasArrayKey logic only for class strings
danog Dec 2, 2022
4e10f16
cs-fix
danog Dec 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Upgrading from Psalm 4 to Psalm 5
## Changed

- [BC] Psalm 5.1 will switch its internal representation of `list<T>` and `non-empty-list<T>` from the TList and TNonEmptyList classes to an unsealed list shape: the TList, TNonEmptyList and TCallableList classes will be removed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to follow semver and name that version 6.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually was hoping to get this merged by Psalm 5.0 given psalm/psalm.dev@dbe30c0, that description is outdated

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not gonna make it though, I'd still love to get at least #8728 merged so people already stop using TList and switch over to keyed lists in time for 5.1

Nothing will change for users: `list<T>` and `non-empty-list<T>` syntax will remain supported and its semantics unchanged.
Psalm 5.0 already deprecates the `TList`, `TNonEmptyList` and `TCallableList` classes: use `\Psalm\Type::getListAtomic`, `\Psalm\Type::getNonEmptyListAtomic` and `\Psalm\Type::getCallableListAtomic` to instantiate list atomics, or directly instantiate TKeyedArray objects with `is_list=true` where appropriate.

- [BC] The only optional boolean parameter of `TKeyedArray::getGenericArrayType` was removed, and will be replaced with a string parameter with a different meaning in Psalm 5.1.

- [BC] Shaped arrays can now be sealed: this brings many assertion improvements and bugfixes, see [the docs for more info](https://psalm.dev/docs/annotating_code/type_syntax/array_types/#sealed-object-like-arrays).

- [BC] All atomic types, `Psalm\Type\Union`, `Psalm\CodeLocation` and storages are fully immutable, use the new setter methods or the new constructors to change properties: these setter methods will return new instances without altering the original instance.
Expand Down
2 changes: 0 additions & 2 deletions docs/running_psalm/plugins/plugins_type_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ foreach (range(1,1) as $_) $a[(string)rand(0,1)] = rand(0,1); // array<string,in

`TCallableArray` - denotes an array that is _also_ `callable`.

`TCallableList` - denotes a list that is _also_ `callable`.

`TCallableKeyedArray` - denotes an object-like array that is _also_ `callable`.

`TClassStringMap` - Represents an array where the type of each value is a function of its string key value
Expand Down
Loading