mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 10:35:53 +01:00
Implementation of unused pattern bindings #2022, continued. Whereas previous PR #6460 took care of parsing, and PR #6479 prepared the stage by using _ in some test cases, this PR has the the actual implementation, using a simple dataflow analysis. --------- Co-authored-by: Burak Emir <bqe@google.com> Co-authored-by: jonmeow <jperkins@google.com>
37 lines
819 B
Cheetah
37 lines
819 B
Cheetah
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon
|
|
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
|
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
|
//
|
|
// AUTOUPDATE
|
|
|
|
HEADER
|
|
|
|
package User;
|
|
|
|
class C {};
|
|
|
|
impl C as Core.INTERFACEWith(C) where .Result = C {
|
|
fn Op[unused self: C](unused other: C) -> C {
|
|
return {};
|
|
}
|
|
}
|
|
impl C as Core.INTERFACEAssignWith(C) {
|
|
fn Op[unused ref self: C](unused other: C) {}
|
|
}
|
|
|
|
fn TestOp(a: C, b: C) -> C {
|
|
//@dump-sem-ir-begin
|
|
return a OP b;
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
fn TestAssign(a: C*, b: C) {
|
|
//@dump-sem-ir-begin
|
|
*a OP= b;
|
|
//@dump-sem-ir-end
|
|
}
|