Retain empty optional import selection evidence

This commit is contained in:
2026-10-19 20:57:41 +00:00
parent 05a28d1178
commit e433988962
3 changed files with 297 additions and 0 deletions

View File

@@ -192,11 +192,21 @@ type SourceInfo struct {
UnderlayIndex int
ImportedFrom *Location
VersionCheck *SourceVersionCheck
importSelections []importSelectionEvidence
namespace *namespaceToken
placementMode placementMode
destinationUnresolved bool
}
// importSelectionEvidence records one completed optional declaration whose
// selected candidates produced no admitted source.
type importSelectionEvidence struct {
path Path
location Location
selector importSelector
outcome importSelectionOutcome
}
// SourceInfoPlacementModeForFacade converts private placement evidence to its
// root-owned numeric representation.
func SourceInfoPlacementModeForFacade(source SourceInfo) uint8 {
@@ -293,6 +303,14 @@ func cloneSourceInfo(source SourceInfo) SourceInfo {
source.ImportedFrom = cloneLocation(source.ImportedFrom)
source.Destination = source.Destination.clone()
source.VersionCheck = cloneSourceVersionCheck(source.VersionCheck)
if source.importSelections != nil {
selections := make([]importSelectionEvidence, len(source.importSelections))
for index, selection := range source.importSelections {
selection.path = selection.path.clone()
selections[index] = selection
}
source.importSelections = selections
}
return source
}