Skip to content

Commit

Permalink
Fix allowing numerals in package names (#1509)
Browse files Browse the repository at this point in the history
This fixes a mistake in #1505 where numerals were disallowed in package
names.
  • Loading branch information
alexcrichton committed Apr 22, 2024
1 parent bcc4392 commit 30200e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/wasmparser/src/validator/names.rs
Expand Up @@ -825,7 +825,10 @@ impl<'a> ComponentNameParser<'a> {

fn take_lowercase_kebab(&mut self) -> Result<&'a KebabStr> {
let kebab = self.take_kebab()?;
if let Some(c) = kebab.chars().find(|c| *c != '-' && !c.is_lowercase()) {
if let Some(c) = kebab
.chars()
.find(|c| c.is_alphabetic() && !c.is_lowercase())
{
bail!(
self.offset,
"character `{c}` is not lowercase in package name/namespace"
Expand Down
1 change: 1 addition & 0 deletions tests/local/component-model/naming.wast
Expand Up @@ -112,4 +112,5 @@
)
(component
(instance (import "a:b/c"))
(instance (import "a1:b1/c"))
)
4 changes: 4 additions & 0 deletions tests/snapshots/local/component-model/naming.wast/16.print
Expand Up @@ -3,4 +3,8 @@
(instance)
)
(import "a:b/c" (instance (;0;) (type 0)))
(type (;1;)
(instance)
)
(import "a1:b1/c" (instance (;1;) (type 1)))
)

0 comments on commit 30200e1

Please sign in to comment.