# Sema: introduce laziness to \`@sizeOf\` · gitcafe/zig

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

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

Visibility: public

Requested revision: fcd4efd8ecda01fe06735ed8b7e2cd2aa93daa19

Requested commit: fcd4efd8ecda01fe06735ed8b7e2cd2aa93daa19

Commit: fcd4efd8ecda01fe06735ed8b7e2cd2aa93daa19

Tree: adc90f10a7a762b65350a1de3fd36bc7e2bb071b

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: introduce laziness to `@sizeOf`

Motivation: the behavior test that is now passing.

The main change in this commit is introducing `Type.abiSizeAdvanced`,
`Value.Tag.lazy_size`, and adjusting `Sema.zirSizeOf` to take advantage
of these.

However, the bulk of lines changed in this commit ended up being moving
logic from value.zig and type.zig into Sema.zig. This logic had no
business being in Type/Value as it was only called from a Sema context,
and we need access to the Sema context for error reporting when a lazy
Value is resolved.

Also worth mentioning is that I bumped up the comptime `@floatToInt`
implementation from using f64 to f128.

```

## Parents

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

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