# Module: improve source spans for initializers and var types · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/cf207df5926c2f303ad92069e44bec51bfa44148)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: cf207df5926c2f303ad92069e44bec51bfa44148

Requested commit: cf207df5926c2f303ad92069e44bec51bfa44148

Commit: cf207df5926c2f303ad92069e44bec51bfa44148

Tree: 093fb27867621e32699bd7fdd179b4e045846917

Author: Veikka Tuominen

Committer: Veikka Tuominen

## Message

````
Module: improve source spans for initializers and var types

```zig
const U = union { foo: u32, bar: u32 };
test {
    var a = U{ .foo = 1213, .bar = 1123 };
    _ = a;
}
test {
    var a: (123 + 5238094) = 0;
    _ = a;
}
```

before:
```
:30: note: additional initializer here
    var a = U{ .foo = 1213, .bar = 1123 };
                             ^~~
:12: error: expected type 'type', found 'comptime_int'
    var a: (123 + 5238094) = 0;
           ^
```
after:
```
:30: note: additional initializer here
    var a = U{ .foo = 1213, .bar = 1123 };
                            ~^~~~~~~~~~
:12: error: expected type 'type', found 'comptime_int'
    var a: (123 + 5238094) = 0;
           ^~~~~~~~~~~~~~~
```

````

## Parents

- [1463144fc88550ba1dca3888acdcdd4903781222](https://git.cafe/gitcafe/zig/commit/1463144fc88550ba1dca3888acdcdd4903781222?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/cf207df5926c2f303ad92069e44bec51bfa44148?format=markdown)
