Skip to content

Commit 2d7e6f2

Browse files
committed
made the following case "include <ID> with {...}" invalid
Signed-off-by: Jiaxiao Zhou (Mossaka) <[email protected]>
1 parent 0a607ba commit 2d7e6f2

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

design/mvp/WIT.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,9 @@ world union-my-world {
283283
The `include` statement also works with [WIT package](#wit-packages-and-use) defined below with the same semantics. For example, the following World `union-my-world-a` is equivalent to `union-my-world-b`:
284284

285285
```wit
286-
// b.wit
287-
interface b { ... }
286+
package local:demo
288287
289-
// a.wit
288+
interface b { ... }
290289
interface a { ... }
291290
292291
world my-world-a {
@@ -296,9 +295,6 @@ world my-world-a {
296295
export d: interface { ... }
297296
}
298297
299-
// union.wit
300-
package local:demo
301-
302298
world union-my-world-a {
303299
include my-world-a
304300
}
@@ -344,7 +340,7 @@ world union-my-world-b {
344340

345341
When two or more included Worlds have the same name for an import or export, the name is considered to be in conflict. The conflict needs to be explicitly resolved by the world author using the `with` keyword. `with` allows the world author to rename the import or export to a different name.
346342

347-
Notice that when import or export names are IDs and since IDs are unique, there is no need to resolve name conflicts. Thus the `with` syntax is a no-op in this case. Only when import or export names are kebab names, name conflicts need to be resolved.
343+
Notice that when import or export names are IDs and since IDs are unique, there is no need to resolve name conflicts. Thus the `with` syntax is invalid when used with `include <ID>`. Only when import or export names are kebab names, name conflicts need to be resolved.
348344

349345
The following example shows how to resolve name conflicts where `union-my-world-a` and `union-my-world-b` are equivalent:
350346

@@ -365,9 +361,9 @@ world union-my-world-b {
365361
}
366362
```
367363

368-
The following example shows that `with` is a no-op when the import or export name is an ID:
364+
The following example shows an invalid example that `with` is used when the import or export name is an ID:
369365

370-
```wit
366+
```wi
371367
package local:demo
372368
373369
world my-world-a {
@@ -384,11 +380,6 @@ world union-my-world-a {
384380
include my-world-a with { a1 as a3 }
385381
include my-world-b with { a1 as a2 }
386382
}
387-
388-
world union-my-world-a {
389-
import a1
390-
import b1
391-
}
392383
```
393384

394385
### A Note on SubTyping

0 commit comments

Comments
 (0)