I think current implementation emits diagnostics if the given "module" is not a module, but I'll add some tests to ensure that.
Regarding future directions, here is another thread for that: Using canImport with submodules and specific types.
Why I don't think renaming to canImportModule
is a good idea:
If we decide to support checking for availability of types and rename canImport
to canImportModule
, I would assume we would similarly introduce canImportClass
, canImportStruct
, canImportEnum
, etc., analogous to import class
, import struct
, import enum
, etc..