1 // Regression: range over a slice whose element type is from an imported package.
2 //
3 // The stage4 type checker produced "WARN: unresolved range type" when
4 // iterating over a slice whose element type was defined in a different
5 // package. The unresolved type became nil, causing nil pointer crashes
6 // in the IR emitter during range-loop codegen.
7 //
8 // Reproduces: import a library, range over its exported []T.
9 // Fixes: pkg/ssa unified builder (cross-package type resolution).
10 11 package main
12 13 import "tests/regressions/should_compile/range_over_imported_slice/lib"
14 15 func main() {
16 for _, it := range lib.Items {
17 println(it.N)
18 }
19 }
20