Граф коммитов

162 Коммитов

Автор SHA1 Сообщение Дата
Siegfried Pammer 1eba12b27f Revert Roslyn upgrade. 2021-09-19 18:25:01 +02:00
Daniel Grunwald e9a1549f28 Allow ignoring errors with missing local symbols. 2021-09-18 22:38:28 +02:00
Daniel Grunwald ac2cdd082e Fix assertions with lambda parameters.
Apparently the newer roslyn version has multiple different symbol instances for the same lambda parameter?
2021-09-18 22:33:20 +02:00
Daniel Grunwald 0df95d757a Update to Roslyn 3.11 2021-09-18 21:38:16 +02:00
Christoph Wille 08928c419c
Merge pull request #12 from icsharpcode/christophwille/ghaction
GH Action CI
2021-06-10 18:52:59 +02:00
Christoph Wille 64527357d4
Make zip files unique 2021-06-10 18:30:14 +02:00
Christoph Wille c6cbbf2338
Specify target for Test 2021-06-10 18:25:31 +02:00
Christoph Wille 4657827282
Use windows-latest instead for ref asms 2021-06-10 18:18:56 +02:00
Christoph Wille c1b5353230
First draft of CI 2021-06-10 18:16:36 +02:00
Daniel Grunwald 072b7bb7dc Fix inference attempting to insert nullability in patterns where it's syntactically invalid 2021-06-05 18:49:34 +02:00
Daniel Grunwald cd21772dfe Fix assertion in HandleThrow() 2021-06-05 18:16:36 +02:00
Daniel Grunwald e2fad8f5f4 More patterns 2021-06-03 20:03:40 +02:00
Daniel Grunwald 9d18e092aa Fix assertions and crashes encountered when inferring types for ICSharpCode.Decompiler. 2021-05-26 21:29:43 +02:00
Daniel Grunwald 87f1ac3a11 Fix some issues discovered when running nullability inference on ILSpy. 2021-05-12 21:59:24 +02:00
Daniel Grunwald 8163e53747 Upgrade to Roslyn 3.9. 2021-05-12 21:03:20 +02:00
Daniel Grunwald 15e17d8aa9 Only visit IMethodReferenceOperation.Instance once. 2020-06-21 19:45:23 +02:00
Daniel Grunwald 37a58e7f87 Merge branch 'extension-methods' of git://github.com/GrahamTheCoder/NullabilityInference 2020-06-21 19:42:33 +02:00
Daniel Grunwald abee669c20 Fix release build. 2020-06-21 16:52:46 +02:00
Daniel Grunwald 9562490821 Fix handling of implicitly-typed `var` variables.
Unlike documented by the nullable-reference-types proposal, these variables do not infer their nullability based on their initializer.
Instead, they are always declared as nullable, and the initializer's nullability only matters for the flow-state.

See also: https://github.com/dotnet/csharplang/issues/3591#issuecomment-647066709
2020-06-21 16:06:58 +02:00
Daniel Grunwald ecf99cb180 Fix `return` statements sometimes not marking the flow-state as unreachable. 2020-06-21 15:14:17 +02:00
Daniel Grunwald fdabd4f72c Improve debugging graph output and allow filtering the exported graph. 2020-06-21 15:13:44 +02:00
Daniel Grunwald 96125f3693
Merge pull request #8 from GrahamTheCoder/deconstruct-non-tuple
Deconstruct non tuple
2020-06-14 21:11:54 +02:00
GrahamTheCoder eb2331b547 GetSymbolType requires us to sub the type args back in afterwards
Method could have also be used by VisitDelegateCreation but it'd conflict with my other PR
2020-06-14 18:10:17 +01:00
GrahamTheCoder bf321c26d7 Comments 2020-06-14 17:51:56 +01:00
GrahamTheCoder 9e70478495 A guess at the solution (passes except the debug assert that fires) 2020-06-14 17:47:50 +01:00
GrahamTheCoder 2c9e62681a Failing test for deconstructing non-tuple
I think the solution is to locate the Deconstruct method of operation.Value.Type, then create an edge from each parameter, to the lhs of the tuple.
I'm unaware of a Roslyn API method that can get the deconstruct method currently.
Here's some of the internal code related to it: https://github.com/dotnet/roslyn/pull/11873/files
Here's the issue request to expose it on the operation: https://github.com/dotnet/roslyn/issues/33590

For the time-being, it may be worth a simple attempt (find a method member called "Deconstruct" with the right number of parameters), then falling back on just returning rhs?
2020-06-14 17:16:55 +01:00
GrahamTheCoder f4759c0615 Handle extension methods which create delegates
The first parameter appears as the "instance" for a reduced extension method
2020-06-14 16:37:28 +01:00
Daniel Grunwald 2e3fe58f0b Handle `[DoesNotReturn]` and `[DoesNotReturnIf(bool)]` 2020-06-14 14:42:47 +02:00
Daniel Grunwald 852476e16f Output statistics, allow strategy selection. 2020-06-14 14:00:26 +02:00
Daniel Grunwald 57a94abc68 Join the nullabilities of the type parameter and type argument when performing type substitution. 2020-06-13 23:53:58 +02:00
Daniel Grunwald a39a7bdb0b Unboxing to a non-nullable type requires a non-null box. 2020-06-13 23:10:54 +02:00
Daniel Grunwald 07b2d7842c Add support for using existing `NotNullIfNotNullAttribute` 2020-06-13 22:58:43 +02:00
Daniel Grunwald e58a738c16 Don't try to add `[NotNullWhen]` attributes to local functions. 2020-06-13 22:38:08 +02:00
Daniel Grunwald 695a759a97 Add `using System.Diagnostics.CodeAnalysis;` when inserting attributes. 2020-06-13 22:36:30 +02:00
Daniel Grunwald 9dcfbcf1bc #5: Implement inference for `[NotNullWhen(bool)]` attribute.
The overall idea here is:
 * in addition to the primary node for the parameter's type, we have two additional nodes whenTrue/whenFalse for out parameters on methods that return a boolean.
 * on return true|false;, connect the current flow-state of the parameter with the whenTrue/whenFalse node.
 * at the call side, if the method is called in a condition, use the whenTrue/whenFalse nodes as flow-states for the assigned variable
 * after nullabilities are inferred for nodes, if the primary node is nullable and exactly one of whenTrue/whenFalse is non-nullable, emit the `[NotNullWhen(..)]` attribute
2020-06-13 21:53:26 +02:00
Daniel Grunwald 10c09d85b3 Also set flow state for `if (dict.TryGetValue(key, out var val))` (with out variable declaration). 2020-06-13 19:10:40 +02:00
Daniel Grunwald 2c7e2d335f Add `--add-nullable-enable` option. 2020-06-13 18:40:51 +02:00
Daniel Grunwald 5d9dfaebb4 Rename "temporary nodes" to "helper nodes".
The nodes aren't temporary; they were initially introduced to represent temporaries in the program, but are now also used for a bunch of other stuff.
2020-06-13 18:11:46 +02:00
Daniel Grunwald 9f0721512e Fix crash on `<typeparam name='T'>` 2020-06-13 17:33:21 +02:00
Daniel Grunwald 78ee868acb Add support for switch expressions. 2020-06-13 17:20:40 +02:00
Daniel Grunwald 7b211657a9 Fix user-defined conversion operators in generic classes. 2020-06-13 17:09:40 +02:00
Daniel Grunwald 623b50c3e8 Add support for `using var x = y;` and tuple comparisons. 2020-06-13 17:01:16 +02:00
Daniel Grunwald 608891874e Add support for `??=`. 2020-06-13 16:55:37 +02:00
Daniel Grunwald 1545990d43 Fix crash with `dynamic` type. 2020-06-13 16:51:54 +02:00
Daniel Grunwald 18c4a6f79b Fix crash with some `await` constructs. 2020-06-13 16:51:34 +02:00
Daniel Grunwald 1a90d4c012 Fix accessing tuple elements by name. 2020-06-13 16:45:52 +02:00
Daniel Grunwald 89b1aefd58 Handle local functions inheriting type parameters from the parent method. 2020-06-13 16:35:58 +02:00
Daniel Grunwald 534ad8207d Support async lambdas. 2020-06-13 16:07:57 +02:00
Daniel Grunwald 8b10f2bf47 Add support for `await`. 2020-06-13 16:03:33 +02:00
Daniel Grunwald 7cefcbe7da Add support for cref in XML documentation. 2020-06-13 15:20:11 +02:00