1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 10:38:49 +01:00
Commit Graph

154 Commits

Author SHA1 Message Date
Matt Brown
3a811f1fb5 Fix/suppress failures 2021-05-19 15:30:36 -04:00
Matthew Brown
18931295c4 Fix #5073 — don’t crash when templates cannot be resolved 2021-05-13 16:55:22 -04:00
Matt Brown
ed43c739e3 Prevent another unsafe template situation, skipping key-of tests for now 2021-05-05 01:06:53 -04:00
Matt Brown
012dafad79 Fix #5383 - prevent unsound use of new static for generics 2021-04-10 13:16:19 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
Bruce Weirdan
841efbdfaf
Make WeakMap generic (#5313) 2021-03-02 22:25:19 -05:00
Matt Brown
474ebf912e Fix #5229 - new SomeTemplatedClass should expand out params even if none passed 2021-02-25 21:20:05 -05:00
elnoro
fff32d0443
added test for multiline templates (#5282) 2021-02-25 17:42:20 -05:00
Matt Brown
8b5e0fc754 Fix #5172 - prevent calling function with implicitly-broader type 2021-02-07 11:07:22 -05:00
Matt Brown
0624098865 Ensure getId() output can always be parsed as a type
Ref #5105
2021-01-25 23:41:51 -05:00
81b75a7884
Check iterator types on yield from (#5042)
* Check iterator types on yield from

* Switch to NodeAbstract

* Make Foo iterable
2021-01-20 17:41:15 -05:00
Matt Brown
ef0d19ed9f Fix #5029 - remember staticness of types when combining 2021-01-16 01:12:18 -05:00
orklah
0e17a3354f
add stubs for standard iterators (#4725)
* add stubs for standard iterators

* Apply suggestions from code review cc @weirdan

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>

* complete stub + delete code made redundant by stubs + fix some syntax in stubs

* fix parse error

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2021-01-07 10:07:07 -05:00
Matthew Brown
ddd99970a9 Fix #4901 - simplify mapping of template types within class 2020-12-29 12:24:33 +00:00
2e3s
e46c68b1e5
Overwrite memoized return type after sum-type candidate is calculated (#4805)
* Overwrite memoized return type after sum-type candidate is calculated

* Fix mismatched types

* Fix code style
2020-12-08 09:35:11 -05:00
Matt Brown
cec8d7138f Fix #4782 - don’t replace closure types with upper bounds when replacing class param types 2020-12-05 11:58:55 -05:00
Matt Brown
4d81682fdd Fix #4731 - expand out class-bound generic types when evaluating instance method 2020-11-29 21:36:50 -05:00
Matt Brown
86b6d6a506 Fix #4733 - don’t replace template types when they’re defined on the same class 2020-11-29 19:12:22 -05:00
Matt Brown
601c1d8cd0 Expand out constants in param types earlier 2020-11-29 19:07:35 -05:00
Matt Brown
58b306b6e3 Ensure class template types are mapped to static methods where necessary
Ref #4733
2020-11-29 17:40:52 -05:00
Matt Brown
0c477da310 Fix test failures 2020-11-25 20:05:09 -05:00
Matt Brown
13b83e6132 Fix #4545 - allow intersections in more places 2020-11-13 09:43:30 -05:00
Matt Brown
f3cc7a7f2f Break apart ReflectorVisitor 2020-10-23 19:53:04 -04:00
Matt Brown
2902a8cc60 Fix #4326 - Prevent later remapping of properties 2020-10-14 21:35:57 -04:00
Matt Brown
4539a2f27e Fix #4326 - prevent more mapping than necessary 2020-10-14 21:22:51 -04:00
Pol Dellaiera
31c924c314
Add more standard iterators (#4320)
* Add CachingIterator, LimitIterator, InfiniteIterator, CallbackFilterIterator, NoRewindIterator.

Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>

* Add related Iterator tests.

Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
2020-10-13 11:35:49 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
92239add4d Add some backwards-incompatible changes for 4.x 2020-08-30 11:44:14 -04:00
m0003r
e81593f359
Localize types on magic properties (#3971)
* Fix #3949 - localize types on magic properties

* fix failing tests

* fix code style

Co-authored-by: m03r <m03r@m03r.net>
2020-08-10 12:45:21 -04:00
Matthew Brown
6085e42fc1 Detect mismatching param names effectively 2020-08-10 09:58:43 -04:00
Brown
afce2dc66f Tighten up rules around instantiation a bit more 2020-08-06 10:18:55 -04:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Brown
1c8f9e94b1 Fix #3907 - allow template as types to be refined via instanceof 2020-07-29 17:46:45 -04:00
Brown
76bd5b6278 Refactor type comparison 2020-07-21 19:40:35 -04:00
Brown
137647a1a0 Fix #3603 - better typed value comparisons for loose equality 2020-06-18 09:31:38 -04:00
Brown
043c4b2a98 Skip test that requires ext-ds 2020-05-25 18:47:59 -04:00
Brown
7e7456c863 Make taint checks more thorough 2020-05-25 17:10:53 -04:00
Brown
109920be88 Expand template param before comparison 2020-05-25 11:51:10 -04:00
Matthew Brown
952216ff21 Fix test 2020-05-20 23:24:50 -04:00
Matthew Brown
2d02064962 Fix #3407 - allow multiple matching generic classes in union 2020-05-20 09:11:17 -04:00
Brown
f335560b69 Allow setting property on templated type 2020-05-19 17:31:05 -04:00
Brown
bf5e178d16 Fix #3289 - treat property on non-generic type like actual value 2020-05-02 23:37:59 -04:00
Brown
3e07684855 Fix iterable coercion for Traversable-extending types
Fixes #3159
2020-04-19 09:15:20 -04:00
Brown
8d29b27204 Allow assigning null to template with null potential 2020-04-18 15:34:14 -04:00
Brown
b0455adced Fix #3177 - prevent crash by using inherited templates 2020-04-18 11:48:22 -04:00
Matthew Brown
d1270a61c7 Suppress MixedAssignment again 2020-04-05 01:04:52 -04:00
Brown
0db49e38f0 Covariant can accept anything 2020-04-04 12:05:01 -04:00
Brown
1b01d7b356 Fix tests 2020-04-04 11:51:24 -04:00
Brown
c0e573ab6a Try harder to understand templated array_map callable array
Fixes #3039
2020-04-03 16:53:56 -04:00
Matthew Brown
de6aee32d1 Fix #3035 - improve templating for property assignments 2020-03-28 17:18:21 -04:00
iggyvolz
94b246b987
Initial commit (#3013) 2020-03-24 18:32:57 -04:00
Brown
f6759c3d16 Check return statement types for inherited docblocks 2020-03-24 17:59:48 -04:00
Matthew Brown
50eb12e562 Fix implementation kink 2020-03-15 16:14:09 -04:00
Brown
a0da7356e9 Fix #2935 - make handling of templated properties much less hacky 2020-03-09 09:59:02 -04:00
Brown
09137b0a32 Fix #2918 - fix contradiction issue with templated equality 2020-03-05 16:21:41 -05:00
Matthew Brown
f44c3488eb Keep track of which arg a given template was assigned from
Fixes #2900 - We only care about the depth of a templated match when templating from a particular argument. The next argument should essentially start afresh
2020-03-01 12:27:18 -05:00
Brown
35c1670602 Fix #2875 - treat intersections more similarly than before 2020-02-27 18:42:15 -05:00
Matthew Brown
fb5a0c39cb Fix #2819 - improve negated assertions on templates 2020-02-14 11:18:47 -05:00
Matthew Brown
b439a573ce Empty is also the bottom type 2020-02-08 11:40:22 -05:00
Matthew Brown
b26deb434d Fix #2771 - replace empty params with generic equivalents
Ref #2755
2020-02-08 11:17:24 -05:00
Matthew Brown
8db4bc7691 Improve formatting of intersection error messages
Also reduce false positives on intersections of templates
2020-02-02 12:25:24 -05:00
Matthew Brown
2cd7f74efb Fix #2554 - treat templated class string as proper subtype of class string 2020-01-07 00:39:16 -05:00
Matthew Brown
086d141f5c Fix #2537 - allow complex intersection templates to be preserved 2020-01-01 13:51:54 -05:00
Matthew Brown
023c4bcef0 Fix #2532 - fix templating inside class method when calling templated method 2019-12-30 07:25:36 -05:00
Matthew Brown
b78f273ccf Improve handling of template params a smidge 2019-12-27 11:49:44 -05:00
Matthew Brown
797a059a84 Prevent static methods using class instance template types 2019-12-14 09:40:09 -05:00
Matthew Brown
b48021dbfd Allow null return on template with null as type
Ref #2466
2019-12-13 21:56:43 -05:00
Matthew Brown
e3d108ebd9 Fix #2439 - fix templating of class-string<T>::returnsStatic 2019-12-08 21:12:25 -05:00
Matthew Brown
69e6624b16 Fix #2436 - fix templating of property types inside templated functions 2019-12-08 19:25:40 -05:00
Matthew Brown
088228f119 Fix template default type issue 2019-11-30 12:54:08 -05:00
Matthew Brown
1e3ecb5fd0 Fix #2387 - ensure docblock return types are checked 2019-11-29 11:20:37 -05:00
Bruce Weirdan
377e47c8bd Added WeakReference support (#2389) 2019-11-29 01:21:38 -05:00
Brown
23c37f829d Move covariant tests into their own place 2019-11-14 11:42:16 -05:00
Matthew Brown
7012bedf4e Fix #2326 - substitute static more responsibly in generic objects 2019-11-12 08:01:22 -05:00
Brown
46d163996e Fix #2321 - prevent inferred template coercion 2019-11-11 09:14:34 -05:00
Brown
4e5af3490a Fix #2315 - allow Traversable->iterable templated casting 2019-11-08 13:11:01 -05:00
Brown
3d7b34e7f6 Fix #2273 - ensure all template params are bound 2019-11-07 11:03:41 -05:00
Brown
64996f464e Prevent empty array workaround to #2308 2019-11-06 16:59:08 -05:00
Brown
3e98c800ec Fix #2309 - prevent closure-inferred generic template params overwriting parent ones 2019-11-06 13:13:02 -05:00
Brown
a8ed6ba9c4 Fix #2308 - prevent specialisation from bound params 2019-11-06 11:20:51 -05:00
Matthew Brown
b81a2d3852 Fix #2306 - allow nullable templated params to be compared to null 2019-11-05 18:37:46 -05:00
Matthew Brown
8f421dc0bb Refactor template calculation out from Psalm\Type\Union 2019-11-03 21:27:40 -05:00
Matthew Brown
6517d0a5f5 Add test 2019-11-01 17:33:54 +01:00
Matthew Brown
bab7e46983 Fix #2281 - allow lists to accept list types 2019-11-01 13:35:16 +00:00
Matthew Brown
4845bbbd49 Improve solution to extended type juggling 2019-10-29 19:30:19 +00:00
Brown
dda68228f3 Fix #2247 - don’t crash when yielding from class with too many template params 2019-10-18 11:01:16 -04:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Brown
3f837a3493 Fix #2192 - allow static return value on templated object 2019-10-11 12:02:41 -04:00
Matthew Brown
0556f28a9f Fix #2224 - make sure literal strings are put into appropriate arrays when templating 2019-10-10 23:38:57 -04:00
Matthew Brown
4ec22cffca Fix #2184 - execute __invoke methods explicitly 2019-09-29 16:01:33 -04:00
Matthew Brown
9af8a9ac38 Fix #2181 - prevent class template types being wiped by anonymous class use 2019-09-27 12:58:32 -04:00
Matthew Brown
e7a69f715d Fix #2106 - add defining class to converted template 2019-09-07 13:44:47 -04:00
Matthew Brown
5d94e340ee Remove unused suppressions in tests 2019-08-18 15:34:32 -04:00
Brown
9aa0fd022c Fix potential coercion gotcha 2019-07-10 14:48:15 -04:00
Brown
2cb7625515 Fix #1932 - coerce empty array passed as template param to general 2019-07-10 13:54:06 -04:00
Brown
e7aadee88f Fix #1931 - narrow down property assignment 2019-07-10 13:49:11 -04:00
Brown
2c6854f403 Massage arg type after coerced param
Ref #1927
2019-07-10 12:12:51 -04:00
Brown
884a03078b Fix #1886 - derived types from templates in new calls should be coercable 2019-07-09 14:48:26 -04:00
Matthew Brown
e6bd30cc0b Allow closures to contain templated @var docblocks
Fixes #1865
2019-07-06 00:18:53 -04:00
Matthew Brown
b4f03abca6 Fix #1886 - allow empty array to be coerced to a mixed one 2019-07-05 17:44:22 -04:00