Skip to content

Commit 0998c17

Browse files
committed
wit: skip incompatible @SInCE gates from transitive included worlds from different packages
Attemped to correct #325.
1 parent f0a65c9 commit 0998c17

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: wit/wit.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ func (s *Stable) WIT(ctx Node, _ string) string {
175175
case *World:
176176
w = ctx
177177
}
178-
if w != nil && w.Package.Name.Version != nil {
178+
if w != nil {
179179
pv := w.Package.Name.Version
180-
if pv.LessThan(s.Since) {
180+
if pv == nil || pv.LessThan(s.Since) {
181181
return ""
182182
}
183183
}
@@ -333,6 +333,18 @@ func (ref *InterfaceRef) WIT(ctx Node, name string) string {
333333
if ref.Stability == nil {
334334
return ref.Interface.WIT(ctx, name)
335335
}
336+
var w *World
337+
switch ctx := ctx.(type) {
338+
case worldImport:
339+
w = ctx.World
340+
case worldExport:
341+
w = ctx.World
342+
case *World:
343+
w = ctx
344+
}
345+
if ref.Stability.Versioned() && w != nil && w.Package != ref.Interface.Package {
346+
return ref.Interface.WIT(ctx, name)
347+
}
336348
return newline(ref.Stability.WIT(ctx, "")) + ref.Interface.WIT(ctx, name)
337349
}
338350

0 commit comments

Comments
 (0)