mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 19:55:00 +01:00
Name lookup into namespaces needs to be resolved early, as part of name resolution, so that we can properly diagnose references to entities before they are fully declared. Make name resolution set a target `value_node` on simple member accesses that name namespace members, and in type-checking rewrite those member accesses into `IdentifierExpression`s that directly reference the namespace member.
22 lines
561 B
Plaintext
22 lines
561 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
|
|
//
|
|
// AUTOUPDATE
|
|
// RUN: %{explorer-run}
|
|
// RUN: %{explorer-run-trace}
|
|
// CHECK:STDOUT: result: 6
|
|
|
|
package ExplorerTest api;
|
|
|
|
namespace N;
|
|
|
|
fn OuterI32() -> type { return i32; }
|
|
fn One() -> i32 { return 1; }
|
|
|
|
fn N.I32() -> type { return i32; }
|
|
fn N.Five() -> I32() { return 5; }
|
|
fn N.Six() -> OuterI32() { return Five() + One(); }
|
|
|
|
fn Main() -> i32 { return N.Six(); }
|