Repository: zng-ui/zng (language: rust)

Issue:
When expr not recognized
#### I tried this code:

```rust
let foo = var(true);

Wgt! {
    when #{foo} {
        background_color = colors::RED;
    }
}
```

#### Following these steps:

1 - Try build.

#### I saw this happen:

Compile error `expected a when block expr and properties`

#### I expected this to happen:

No error or an error saying that `&bool` is not `bool`.



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e3a14108f..18fbe1286 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 # Unreleased
 
+* Fix when expr not recognized.
 * Fix `WINDOWS.is_loading`.
 * Add `WINDOWS.wait_loaded`.
 * **Breaking** Refactored `Button::cmd_param` to accept any type var.
diff --git a/crates/zng-app-proc-macros/src/widget_util.rs b/crates/zng-app-proc-macros/src/widget_util.rs
index e3eafe3b9..581fa307f 100644
--- a/crates/zng-app-proc-macros/src/widget_util.rs
+++ b/crates/zng-app-proc-macros/src/widget_util.rs
@@ -413,17 +413,23 @@ fn parse_without_eager_brace(input: parse::ParseStream) -> TokenStream {
                 }
             }
         } else if input.peek2(token::Brace) {
-            if let Some(p) = input.cursor().punct() {
-                if p.0.as_char() != '.' {
-                    let tt = input.parse::<TokenTree>().unwrap();
-                    tt.to_tokens(&mut r);
-                    let tt = input.parse::<TokenTree>().unwrap();
-                    tt.to_tokens(&mut r);
-                    continue; // found #{ }
+            if input.peek(Token![#]) {
+                // #
+                let tt = input.parse::<TokenTree>().unwrap();
+                tt.to_tokens(&mut r);
+                // { .. }
+                let tt = input.parse::<TokenTree>().unwrap();
+                tt.to_tokens(&mut r);
+
+                if input.peek(token::Brace) {
+                    break; // found { } after expr or Struct #{ }
                 }
+            } else {
+                // item before brace
+                let tt = input.parse::<TokenTree>().unwrap();
+                tt.to_tokens(&mut r);
+                break;
             }
-            input.parse::<TokenTree>().unwrap().to_tokens(&mut r);
-            break; // found { } after expr or Struct { }
         } else if !is_start && input.peek(token::Brace) {
             break; // found { } after expr
         } else {


Test patch: