[SR-3908] Extension methods visible without importing module in a file #46493
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
declarations
Feature: declarations
extension
Feature → declarations: `extension` declarations
multiple files
Flag: An issue whose reproduction requires multiple files
multiple modules
Flag: An issue whose reproduction requires multiple modules
name lookup
Area → compiler → type checker: Name lookup
swift 5.9
unexpected behavior
Bug: Unexpected behavior or incorrect output
Attachment: Download
Additional Detail from JIRA
md5: 7cc3dd991a1637efb2f2ca9e6d75b83d
is duplicated by:
import
#47098Issue Description:
The attached package contains three targets:
foo
- defines aVersion
struct which can be initialized by a string param.bar
- depends on foo and defines an extension with an initializer toVersion
with no parametersexe
- depends on foo and bar and has two files.bar
foo
and callsVersion()
This should not compile or run because
Version()
is defined inbar
andbar
is not imported inmain.swift
.It works as expected after removing
import bar
fromother.swift
(needs a swift package clean though).The text was updated successfully, but these errors were encountered: