# stage1: fix ir_resolve_str\(\) to return slice · gitcafe/zig

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

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

Visibility: public

Requested revision: 3464351d1e0a1e840d0b1a6267d0a5bf4113cfcc

Requested commit: 3464351d1e0a1e840d0b1a6267d0a5bf4113cfcc

Commit: 3464351d1e0a1e840d0b1a6267d0a5bf4113cfcc

Tree: fbdc987d4377b0126bc8342dfd8cb2d4d465f5b8

Author: Michael Dusan

Committer: Andrew Kelley

## Message

```
stage1: fix ir_resolve_str() to return slice

`ir_resolve_str()` bug returns array expression even when when sliced
to a lesser length. Fix is to return array if slice.len == array.len,
otherwise return slice.

Bug report use-case is based on one builtin function. However, at least
the following builtins were exposed to the bug:

    `@byteOffsetOf`
    `@cDefine`
    `@cImport`
    `@cInclude`
    `@cUndef`
    `@compileError`
    `@embedFile`
    `@export`
    `@fieldParentPtr`
    `@hasDecl`
    `@hasField`
    `@import`
    `@unionInit`

closes #3384

```

## Parents

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

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