Skip to content

[cpp] Uppercase classnames in return types get confused for macros #251

@takamori

Description

@takamori

Repros with the following code.

class URL;
class URl;

class Test {
  // Bug 1: This URL is highlighted differently
  URL DoSomething() {
    // Bug 2: Smart indentation from newline is broken (2 spaces too many)
    URL url;
    return url;
  }

  // Bug 3: The std:: is highlighted yet more differently (and default
  // indentation is broken
  // Bug 4: Smart indentation _after_ the DoSomething function is broken even
  // worse. (6 spaces too many)
  std::string doFoo(const std::string& a) {
    return absl::StrCat("something long", a);
  }

  // Correct highlighting and indentation after one function call.
  std::string doFoo2(const std::string& a) {
    return absl::StrCat("something long", a);
  }

  // Correct highlighting of types that are not fully UPPERCASE.
  URl DoSomething2() {
    URL url;
    return url;
  }

  // Also correct.
  std::string doFoo3(const std::string& a) {
    return absl::StrCat("something long", a);
  }
  std::string doFoo4(const std::string& a) {
    return absl::StrCat("something long", a);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions