clang-rs icon indicating copy to clipboard operation
clang-rs copied to clipboard

completion_test fails with clang15.0.3

Open mo-xiaoming opened this issue 2 years ago • 0 comments

Using main branch with clang15.0.3, run cargo test locally, I got error

libclang: clang version 15.0.3 (https://github.com/llvm/llvm-project.git 4a2c05b05ed07f1f620e94f6524a8b4b2760a0b1)
thread 'test' panicked at 'assertion failed: `(left == right)`
  left: `7`,
 right: `6`', tests/completion.rs:58:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a6b7274a462829f8ef08a1ddcdcec7ac80dbf3e1/library/std/src/panicking.rs:556:5
   1: core::panicking::panic_fmt
             at /rustc/a6b7274a462829f8ef08a1ddcdcec7ac80dbf3e1/library/core/src/panicking.rs:142:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/a6b7274a462829f8ef08a1ddcdcec7ac80dbf3e1/library/core/src/panicking.rs:181:5
   4: tests::completion_test::test::{{closure}}
             at ./tests/completion.rs:58:13
   5: tests::with_temporary_file::{{closure}}
             at ./tests/tests.rs:69:55
   6: tests::with_temporary_files::{{closure}}
             at ./tests/tests.rs:80:9
   7: tests::with_temporary_directory
             at ./tests/tests.rs:64:5
   8: tests::with_temporary_files
             at ./tests/tests.rs:73:5
   9: tests::with_temporary_file
             at ./tests/tests.rs:69:5
  10: tests::completion_test::test
             at ./tests/completion.rs:17:5
  11: tests::test
             at ./tests/tests.rs:123:5
  12: tests::test::{{closure}}
             at ./tests/tests.rs:118:1
  13: core::ops::function::FnOnce::call_once
             at /rustc/a6b7274a462829f8ef08a1ddcdcec7ac80dbf3e1/library/core/src/ops/function.rs:251:5
  14: core::ops::function::FnOnce::call_once
             at /rustc/a6b7274a462829f8ef08a1ddcdcec7ac80dbf3e1/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test test ... FAILED

It seems this clang version produces different results.get_results()

[
    CompletionResult {
        kind: FieldDecl,
        string: CompletionString {
            chunks: [
                ResultType(
                    "int",
                ),
                TypedText(
                    "a",
                ),
            ],
        },
    },
    CompletionResult {
        kind: StructDecl,
        string: CompletionString {
            chunks: [
                TypedText(
                    "A",
                ),
                Text(
                    "::",
                ),
            ],
        },
    },
    CompletionResult {
        kind: FieldDecl,
        string: CompletionString {
            chunks: [
                ResultType(
                    "int",
                ),
                TypedText(
                    "b",
                ),
            ],
        },
    },
    CompletionResult {
        kind: FieldDecl,
        string: CompletionString {
            chunks: [
                ResultType(
                    "int",
                ),
                TypedText(
                    "c",
                ),
            ],
        },
    },
    CompletionResult {
        kind: Destructor,
        string: CompletionString {
            chunks: [
                ResultType(
                    "void",
                ),
                TypedText(
                    "~A",
                ),
                LeftParenthesis,
                RightParenthesis,
            ],
        },
    },
    CompletionResult {
        kind: Method,
        string: CompletionString {
            chunks: [
                ResultType(
                    "A &",
                ),
                TypedText(
                    "operator=",
                ),
                LeftParenthesis,
                Placeholder(
                    "const A &",
                ),
                RightParenthesis,
            ],
        },
    },
    CompletionResult {
        kind: Method,
        string: CompletionString {
            chunks: [
                ResultType(
                    "A &",
                ),
                TypedText(
                    "operator=",
                ),
                LeftParenthesis,
                Placeholder(
                    "A &&",
                ),
                RightParenthesis,
            ],
        },
    },
]

mo-xiaoming avatar Nov 05 '22 02:11 mo-xiaoming