1. 28 2月, 2019 1 次提交
  2. 25 2月, 2019 1 次提交
    • N
      Revise NullableWalker to use a two-state solution · 6c329e3e
      Neal Gafter 提交于
      The NullableWalker is revised so that the inferred state of an expression is either `NotNull` or `MaybeNull` (represented by the new type `NullableFlowState`).  There is no longer such as thing as an oblivious rvalue.  There are four kinds of lvalues:
      - oblivious lvalues read as NotNull but null can be written to them
      - annotated lvalues read as MaybeNull and null can be written to them
      - unannotated lvalues read as NotNull and null may not be written to them
      - unconstrained type parameters read as MaybeNull but null may not be written to them
      
      In order to preserve the safety in the face of such unconstrained type parameters, we warn immediately when a null value of such a type is introduced.  This is a safety warning.  The contexts in which such a warning are given are
      - `default` and `default(T)`
      - `null` conversion to `T` (when `T` is known to be ref type)
      - `e?.M()` when the return type is `T`
      - dynamic conversion or cast to `T` when the dynamic might be null
      - explicit conversion to `T`
      - `e as T` when there is not an implicit conversion from the type of `e` to `T`
      - a call to a method like `FirstOrDefault()` that is annotated with `[MaybeNull] (not yet implemented)
      
      We remove the hidden diagnostics previously computed by the NullableWalker.
      
      We add debugger display support for a number of types used by the NullableWalker.  The display for `NullableWalker` summarizes the computed nullability of variables in a nice compact form.
      
      We remove support for definite assignment in the NullableWalker.  Some scenarios involving the use of not-definitely-assigned variables may cause cascaded diagnostics.  We might remove them in the future by initializing all vaiables to the `NotNull` state when they enter scope.
      
      We overhaul and simplify the inplementation of conversions, the null-conditional operator, and result inference for lifted operators.
      
      We simplify the Meet and Join operations so that they form a lattice on both the NullableAnnotation and NullableFlowState.
      
      Catch variables are now initialized to a non-null state on entry to the catch block.
      
      In unreachable code, every expression produces a non-null rvalue.  An erroneous expression produces a non-null rvalue (to suppress cascaded diagnostics).
      6c329e3e
  3. 23 2月, 2019 1 次提交
  4. 13 2月, 2019 1 次提交
  5. 05 2月, 2019 1 次提交
  6. 04 2月, 2019 1 次提交
    • A
      Add Preview langversion and change Default · 28e249ec
      Andy Gocke 提交于
      Adds a new "Preview" language version for C# that means the latest
      supported language version + the preview features available in the
      compiler. Also changes the "Default" (unspecified) language version to
      mean Preview, but provides a warning when preview features are used.
      28e249ec
  7. 01 2月, 2019 1 次提交
  8. 11 1月, 2019 1 次提交
  9. 04 1月, 2019 2 次提交
  10. 11 12月, 2018 1 次提交
  11. 29 11月, 2018 1 次提交
  12. 07 11月, 2018 1 次提交
    • N
      Discard pattern versus symbol named `_` (#30847) · 3a260c76
      Neal Gafter 提交于
      * Discard pattern versus symbol named `_`
      
      - A discard pattern is not accepted at the top level in a switch statement. In that case `_` binds to a constant in scope with a warning WRN_CaseConstantNamedUnderscore that is included in a warning wave.
      - A discard pattern is not accepted at the top level in an is-expression. In that case `_` binds to a type in scope with a warning WRN_IsTypeNamedUnderscore that is included in a warning wave.
      - Elsewhere a pattern `_` is a discard without warning no matter what definition for `_` might be in scope.
      
      Fixes #30650
      See also #30846
      3a260c76
  13. 27 10月, 2018 1 次提交
  14. 17 10月, 2018 1 次提交
  15. 16 10月, 2018 1 次提交
  16. 11 10月, 2018 1 次提交
  17. 26 9月, 2018 1 次提交
  18. 08 9月, 2018 1 次提交
  19. 07 9月, 2018 1 次提交
  20. 06 9月, 2018 1 次提交
  21. 31 8月, 2018 1 次提交
  22. 07 8月, 2018 1 次提交
  23. 03 8月, 2018 1 次提交
  24. 31 7月, 2018 1 次提交
  25. 19 5月, 2018 1 次提交
  26. 14 4月, 2018 1 次提交
  27. 10 4月, 2018 1 次提交
    • N
      Distinguish irrefutable and refutable patterns in the `is` expression · 818dc464
      Neal Gafter 提交于
      Both refutable and irrefutable is-pattern matches affect definite assignment:
      - an irrefutable match leaves pattern variables definitely assigned
      - a refutable match is an error
      Fixes #25890
      
      Also, we check to see if a constant input makes the result refutable or irrefutable:
      - If a constant cannot match the pattern, we issue a warning
      - If a constant always matches a constant pattern, we issue a warning
      The latter two are subject to compat council approval.
      Fixes #16099
      818dc464
  28. 28 3月, 2018 1 次提交
    • N
      Report an error when discard pattern is used but there is a _ in scope · 734a8c8f
      Neal Gafter 提交于
      Note that this error does not apply to the discard *designation*, only the discard *pattern*.
      Since the discard designation is new in C#8, this is not a breaking change.
      
      Report an error if a constant named '_' is used as a constant pattern.
      This error has been confirmed by the LDM on 2017-11-20
      
      Also report a warning if a type named '_' is used in an is-type expression.
      This requires compat council confirmation.
      
      Open issues in https://github.com/dotnet/csharplang/issues/1054 describe pending LDM decisions for potentialy breaking scenarios.
      734a8c8f
  29. 23 3月, 2018 1 次提交
  30. 21 3月, 2018 1 次提交
  31. 16 3月, 2018 1 次提交
  32. 13 3月, 2018 1 次提交
  33. 24 2月, 2018 1 次提交
  34. 10 12月, 2017 1 次提交
  35. 14 11月, 2017 2 次提交
  36. 03 11月, 2017 1 次提交
  37. 22 8月, 2017 1 次提交
    • C
      Changes to opt-in/out for warnings (#21309) · 1eb5a61e
      Charles Stoner 提交于
      Changes to opt-in/out for warnings
      - Additional feature flag options
      - Distinct opt-in for non-null warnings
      - [NullableOptOut] no longer opts-out of warnings, it only controls whether unadorned reference types are treated as non-null
      - Allow treating locals as nullable regardless of declaration
      1eb5a61e
  38. 12 7月, 2017 1 次提交