Introduce --incompatible_static_name_resolution
This implements a part of the name resolution document: https://github.com/bazelbuild/proposals/blob/master/docs/2018-06-18-name-resolution.md
When the flag is set:
- Builtins may be shadowed (e.g. `len = 2`) on top-level
- Symbols may be used before their definition point, e.g.
def fct(): return x
x = 2
In a followup change, we'll need to update the dynamic Environment too (to have truly lexical binding).
https://github.com/bazelbuild/bazel/issues/5637
RELNOTES: None.
PiperOrigin-RevId: 210412609
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java
index 187bf0f..2062ae1 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkSemantics.java
@@ -87,6 +87,8 @@
public abstract boolean incompatibleRemoveNativeHttpArchive();
+ public abstract boolean incompatibleStaticNameResolution();
+
public abstract boolean incompatibleStringIsNotIterable();
public abstract boolean internalSkylarkFlagTestCanary();
@@ -129,6 +131,7 @@
.incompatibleRangeType(false)
.incompatibleRemoveNativeGitRepository(false)
.incompatibleRemoveNativeHttpArchive(false)
+ .incompatibleStaticNameResolution(false)
.incompatibleStringIsNotIterable(false)
.internalSkylarkFlagTestCanary(false)
.build();
@@ -184,6 +187,8 @@
public abstract Builder incompatibleRemoveNativeHttpArchive(boolean value);
+ public abstract Builder incompatibleStaticNameResolution(boolean value);
+
public abstract Builder incompatibleStringIsNotIterable(boolean value);
public abstract Builder internalSkylarkFlagTestCanary(boolean value);