## Compiler version Scala compiler version 3.0.0-M3 -- Copyright 2002-2020, LAMP/EPFL ## Minimized code ```Scala // test.scala package p { class C } package q { package p { class K { import _root_.p def f() = new p.C } } } ``` ## Output Hey, it compiles! ## Expectation An import cannot shadow an enclosing definition. `s/package p/object p` results in expected ambiguous reference. Arguably a package is not a definition, the symbol is introduced by a packaging. Here, `q.p` is made available via packagings in the current compilation unit; for definitions, that binding is higher precedence than an import. Possibly, this behavior is expected or understood, and the spec should say explicitly that bindings of names of packagings are always of least precedence.