[all-commits] [llvm/llvm-project] ec725b: [clang-format] Fix C# nullable-related errors

Marek Kurdej via All-commits all-commits at lists.llvm.org
Thu May 6 03:11:37 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ec725b307f3fdc5656459047bab6e69669d9534f
      https://github.com/llvm/llvm-project/commit/ec725b307f3fdc5656459047bab6e69669d9534f
  Author: Eliza Velasquez <exv at google.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M clang/lib/Format/FormatToken.h
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/lib/Format/UnwrappedLineParser.h
    M clang/unittests/Format/FormatTestCSharp.cpp

  Log Message:
  -----------
  [clang-format] Fix C# nullable-related errors

This fixes two errors:

Previously, clang-format was splitting up type identifiers from the
nullable ?. This changes this behavior so that the type name sticks with
the operator.

Additionally, nullable operators attached to return types in interface
functions were not parsed correctly. Digging deeper, it looks like
interface bodies were being parsed differently than classes and structs,
causing MustBeDeclaration to be incorrect for interface members. They
now share the same logic.

One other change is reintroducing the CSharpNullable type independent of
JsTypeOptionalQuestion. Despite having a similar semantic purpose, their
actual syntax differs quite a bit.

Reviewed By: MyDeveloperDay, curdeius

Differential Revision: https://reviews.llvm.org/D101860




More information about the All-commits mailing list