You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package p
import "imported"
func F1 => imported.F
func F2 => imported.F
will serialize the data for imported.F twice in the export data for this package, once for F1 and once for F2.
While this doesn't bother the importer (it already can handle multiple imports of the same object), it breaks the original invariant that objects of the current package are serialized exactly once in the export data (we use maps to ensure this for packages and types).
The text was updated successfully, but these errors were encountered:
Seems like it would be a little cleaner to instead export aliases as
aliasTag, aliasName, orig.qualifiedName
and ensure we emit aliases after we've emitted the original object, but I'm okay with this too. Like you say, I don't think it should matter much in practice either way.
Emitting imported.F exactly once in p's export data is not sufficient to avoid duplication. The importer needs to know that p.F1 and importer.F (which it may already have) are the same object, which means, as Matthew says, that the export data for the alias must record the canonical name of the original object. But the qualified name is also not sufficient, since the object definiion is required. I think you need:
aliasTag, aliasName, orig.qualifiedName, obj
where obj is either the definition of the original object, or a back reference to an earlier object. obj should also permit "unknownTag" to represent dangling aliases.
will serialize the data for
imported.F
twice in the export data for this package, once forF1
and once forF2
.While this doesn't bother the importer (it already can handle multiple imports of the same object), it breaks the original invariant that objects of the current package are serialized exactly once in the export data (we use maps to ensure this for packages and types).
The text was updated successfully, but these errors were encountered: