File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ impl<'a> Parse<'a> for ImportType<'a> {
118118 }
119119}
120120
121- /// Represents a package path in the AST .
121+ /// AST representation of a path to an item such as a world in a package (e.g. `foo:bar/qux`) .
122122#[ derive( Debug , Clone , Serialize ) ]
123123#[ serde( rename_all = "camelCase" ) ]
124124pub struct PackagePath < ' a > {
Original file line number Diff line number Diff line change @@ -184,6 +184,7 @@ impl<'a> AstResolver<'a> {
184184 // If there's a target world in the directive, validate the composition
185185 // conforms to the target
186186 if let Some ( path) = & self . document . directive . targets {
187+ log:: debug!( "validating composition targets world `{}`" , path. string) ;
187188 let item = self . resolve_package_export ( & mut state, path) ?;
188189 match item {
189190 ItemKind :: Type ( Type :: World ( world) ) => {
@@ -1563,6 +1564,7 @@ impl<'a> AstResolver<'a> {
15631564 state : & mut State < ' a > ,
15641565 path : & ' a ast:: PackagePath < ' a > ,
15651566 ) -> ResolutionResult < ItemKind > {
1567+ log:: debug!( "resolving package export `{}`" , path. string) ;
15661568 // Check for reference to local item
15671569 if path. name == self . document . directive . package . name {
15681570 return self . resolve_local_export ( state, path) ;
Original file line number Diff line number Diff line change @@ -114,6 +114,15 @@ impl FileSystemPackageResolver {
114114 ) ;
115115
116116 continue ;
117+ } else if path. extension ( ) . and_then ( std:: ffi:: OsStr :: to_str) == Some ( "wit" ) {
118+ return Err ( Error :: PackageResolutionFailure {
119+ name : key. name . to_string ( ) ,
120+ span : * span,
121+ source : anyhow ! (
122+ "WIT packages must be directories, not files: `{path}`" ,
123+ path = path. display( )
124+ ) ,
125+ } ) ;
117126 }
118127
119128 if !path. is_file ( ) {
You can’t perform that action at this time.
0 commit comments