bazel syntax: delete SkylarkImport

https://github.com/bazelbuild/bazel/commit/b2e1fe367269103e127718131163cd702cefcdff caused skyframe to check load strings for validity,
so the parse-time checks are now redundant; this change deletes them.

The skyframe checks require only that the strings are valid labels,
so load("foo.bzl") is equivalent to load(":foo.bzl").
Before, the colon was required, as a consequence of the obsolete
strategy used to transition away from non-label filenames.
The treatment of label strings by load is now consistent with
other label strings in a BUILD file.

This change removes another lib.syntax->lib.cmdline dependency.
The remaining two are GlobalFrame.label (broken in unknown commit)
and GlobalFrame.callerLabel, used for the Starlark Label function
(broken in unknown commit).

Also:
- PackageFunctionTest: add tests of load validation.
- ParserTest: break (subclass) dependency on EvaluationTestCase
- BuildFileAST: remove all mention of RepositoryMapping.
- SkylarkEvaluationTests: delete obsolete tests.
- ValidationTest: move tests for toplevel for/if statements here.
- ParserTest: delete load validation checks.
- ParserInput: remove spurious IOException and simplify one caller.
PiperOrigin-RevId: 270958511
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
index 2dfce20..e20ab8c 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/PackageFunctionTest.java
@@ -582,18 +582,49 @@
   }
 
   @Test
-  public void testLoadRelativePath() throws Exception {
-    scratch.file("pkg/BUILD", "load(':ext.bzl', 'a')");
-    scratch.file("pkg/ext.bzl", "a = 1");
-    validPackageWithoutErrors(PackageValue.key(PackageIdentifier.parse("@//pkg")));
+  public void testLoadOK() throws Exception {
+    scratch.file("p/a.bzl", "a = 1; b = 1; d = 1");
+    scratch.file("p/subdir/a.bzl", "c = 1; e = 1");
+    scratch.file(
+        "p/BUILD",
+        //
+        "load(':a.bzl', 'a')",
+        "load('a.bzl', 'b')",
+        "load('subdir/a.bzl', 'c')",
+        "load('//p:a.bzl', 'd')",
+        "load('//p:subdir/a.bzl', 'e')");
+    validPackageWithoutErrors(PackageValue.key(PackageIdentifier.parse("@//p")));
+  }
+
+  // See WorkspaceASTFunctionTest for tests that exercise load('@repo...').
+
+  @Test
+  public void testLoadBadLabel() throws Exception {
+    scratch.file("p/BUILD", "load('this\tis not a label', 'a')");
+    reporter.removeHandler(failFastHandler);
+    SkyKey key = PackageValue.key(PackageIdentifier.parse("@//p"));
+    SkyframeExecutorTestUtils.evaluate(skyframeExecutor, key, /*keepGoing=*/ false, reporter);
+    assertContainsEvent(
+        "in load statement: invalid target name 'this<?>is not a label': target names may not"
+            + " contain non-printable characters");
   }
 
   @Test
-  public void testLoadAbsolutePath() throws Exception {
-    scratch.file("pkg1/BUILD");
-    scratch.file("pkg2/BUILD", "load('//pkg1:ext.bzl', 'a')");
-    scratch.file("pkg1/ext.bzl", "a = 1");
-    validPackageWithoutErrors(PackageValue.key(PackageIdentifier.parse("@//pkg2")));
+  public void testLoadFromExternalPackage() throws Exception {
+    scratch.file("p/BUILD", "load('//external:file.bzl', 'a')");
+    reporter.removeHandler(failFastHandler);
+    SkyKey key = PackageValue.key(PackageIdentifier.parse("@//p"));
+    SkyframeExecutorTestUtils.evaluate(skyframeExecutor, key, /*keepGoing=*/ false, reporter);
+    assertContainsEvent("Starlark files may not be loaded from the //external package");
+  }
+
+  @Test
+  public void testLoadWithoutBzlSuffix() throws Exception {
+    scratch.file("p/BUILD", "load('//p:file.starlark', 'a')");
+    reporter.removeHandler(failFastHandler);
+    SkyKey key = PackageValue.key(PackageIdentifier.parse("@//p"));
+    SkyframeExecutorTestUtils.evaluate(skyframeExecutor, key, /*keepGoing=*/ false, reporter);
+    assertContainsEvent("The label must reference a file with extension '.bzl'");
   }
 
   @Test