Commit b6eca18
test: regression test for #1389
Add a minimal test case that reproduces the conditional variable reuse
bug in type initialization.
The test demonstrates:
- A named type (MyType) that is initialized early
- An interface (MyInterface) with a method returning MyType
- The compiler incorrectly reuses the parent type's null check
condition to control method type initialization
In the generated IR (out.ll):
- Line 163-164: Defines %9 = (MyType == null)
- Line 182: Reuses the same %9 to control InitNamed call
- When MyType already exists, method initialization is skipped
This is the same bug pattern as io/fs.FileMode in the reported issue,
but in a much simpler form for easier understanding and testing.
Related: #1389
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 2363d28 commit b6eca18
2 files changed
+425
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments