mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:40:11 +01:00
- Added detection of unformed usage with `return var`, control-flow statements and member access. - Refactored the work flow: made flow facts a class and moved operations of flow facts into the class. - Added, cleaned and renamed test cases. Some test cases for the dynamic unformed check were suppressed by the static check. They are now added back. Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
23 lines
861 B
Plaintext
23 lines
861 B
Plaintext
// 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
|
|
//
|
|
// RUN: %{not} %{explorer} %s 2>&1 | \
|
|
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
|
|
// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
|
|
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
|
|
// AUTOUPDATE: %{explorer} %s
|
|
|
|
package ExplorerTest api;
|
|
|
|
fn Main() -> i32 {
|
|
var (x: i32, y: i32);
|
|
x = 1;
|
|
if (0 == 1) {
|
|
y = 0;
|
|
}
|
|
// Static analysis thinks `y` may be formed, defer the check to run-time.
|
|
// CHECK: RUNTIME ERROR: {{.*}}/explorer/testdata/unformed/dynamic/fail_pattern_declare.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<y>>
|
|
return y;
|
|
}
|