-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
Team: Mojo LibrariesRelevant to the Mojo libraries team, which will review and decide on the issue or PR.Relevant to the Mojo libraries team, which will review and decide on the issue or PR.bugSomething isn't workingSomething isn't workingmojoIssues that are related to mojoIssues that are related to mojo
Description
Bug description
one.mojo:mojo one.mojo: Runsmojo --no-optimization one.mojo: Error:note: could not simplify operator apply_result_slot
two.mojo:mojo -D CRASH two.mojo: Compiler crashmojo -D S two.mojo: Runsmojo -D T two.mojo: Error:note: struct not a writeable typemojo --no-optimization -D $X two.mojoError:note: could not simplify operator apply_result_slot(XisS,T,CRASH)
Steps to reproduce
-
one.mojofrom reflection import get_type_name, struct_field_types struct A[T: AnyType, //, foo: T]: ... @fieldwise_init struct B: var b: Bool struct S: var field: A[B(True)] fn main(): print(get_type_name[struct_field_types[S]()[0]]())
$ mojo one.mojo one.A[<unprintable>, <unprintable>]
$ mojo --no-optimization one.mojo /home/aditya/Projects/modular/crashes/reflection/one.mojo:12:4: error: function instantiation failed fn main(): ^ /home/aditya/Projects/modular/crashes/reflection/one.mojo:12:4: note: call expansion failed with parameter value(s): (...) open-source/max/mojo/stdlib/std/reflection/reflection.mojo:331:4: note: function instantiation failed open-source/max/mojo/stdlib/std/reflection/reflection.mojo:368:12: note: could not simplify operator apply_result_slot(:(i1, !kgen.pointer<struct<(i1) memoryOnly>> byref_result) -> !kgen.none @"one::B::__init__(::Bool)", 1) /home/aditya/.local/bin/mojo: error: failed to run the pass manager
-
two.mojofrom reflection import get_type_name, struct_field_types from sys import is_defined struct A[T: Movable, //, foo: Optional[T]]: ... @fieldwise_init @register_passable("trivial") struct B(Movable): var b: Bool @fieldwise_init struct C(Movable): var b: Bool struct S: var field: A[B(True)] struct T: var field: A[C(True)] struct U: var b: A[B(True)] var c: A[C(True)] fn main(): @parameter if is_defined["S"](): print(get_type_name[struct_field_types[S]()[0]]()) elif is_defined["T"](): print(get_type_name[struct_field_types[T]()[0]]()) elif is_defined["CRASH"](): print(get_type_name[struct_field_types[U]()[1]]())
$ mojo -D CRASH two.mojo Please submit a bug report to https://github.com/modular/modular/issues and include the crash backtrace along with all the relevant source codes. Stack dump: 0. Program arguments: /home/aditya/.local/bin/mojo -D CRASH two.mojo [595931:595932:20260103,121048.140555:ERROR directory_reader_posix.cc:42] opendir /home/aditya/.local/share/modular/crashdb/attachments/71ef12da-ced0-4751-9ba0-a60b23111c9f: No such file or directory (2) #0 0x000055fa66cd6f8b (/home/aditya/.local/bin/mojo+0x7a82f8b) #1 0x000055fa66cd47da (/home/aditya/.local/bin/mojo+0x7a807da) #2 0x000055fa66cd7b37 (/home/aditya/.local/bin/mojo+0x7a83b37) #3 0x00007faa87e27290 __restore_rt (/lib64/libc.so.6+0x1a290) #4 0x000055fa63069f32 (/home/aditya/.local/bin/mojo+0x3e15f32) #5 0x000055fa63069122 (/home/aditya/.local/bin/mojo+0x3e15122) #6 0x000055fa63583667 (/home/aditya/.local/bin/mojo+0x432f667) #7 0x000055fa62ec08c8 (/home/aditya/.local/bin/mojo+0x3c6c8c8) #8 0x000055fa6306e8d6 (/home/aditya/.local/bin/mojo+0x3e1a8d6) #9 0x000055fa6303dbef (/home/aditya/.local/bin/mojo+0x3de9bef) #10 0x000055fa6304070f (/home/aditya/.local/bin/mojo+0x3dec70f) #11 0x000055fa63040626 (/home/aditya/.local/bin/mojo+0x3dec626) #12 0x000055fa6305d07f (/home/aditya/.local/bin/mojo+0x3e0907f) #13 0x000055fa640d6bb1 (/home/aditya/.local/bin/mojo+0x4e82bb1) #14 0x000055fa640d3bad (/home/aditya/.local/bin/mojo+0x4e7fbad) #15 0x000055fa6304a9d2 (/home/aditya/.local/bin/mojo+0x3df69d2) #16 0x000055fa63059202 (/home/aditya/.local/bin/mojo+0x3e05202) #17 0x000055fa6643328f (/home/aditya/.local/bin/mojo+0x71df28f) #18 0x000055fa664366b0 (/home/aditya/.local/bin/mojo+0x71e26b0) #19 0x000055fa635da78d (/home/aditya/.local/bin/mojo+0x438678d) #20 0x000055fa62f416e7 (/home/aditya/.local/bin/mojo+0x3ced6e7) #21 0x000055fa635da38b (/home/aditya/.local/bin/mojo+0x438638b) #22 0x000055fa635d9e8d (/home/aditya/.local/bin/mojo+0x4385e8d) #23 0x000055fa640d68f6 (/home/aditya/.local/bin/mojo+0x4e828f6) #24 0x000055fa640d3bad (/home/aditya/.local/bin/mojo+0x4e7fbad) #25 0x000055fa62fd08a3 (/home/aditya/.local/bin/mojo+0x3d7c8a3) #26 0x000055fa62fcffd6 (/home/aditya/.local/bin/mojo+0x3d7bfd6) #27 0x000055fa62d90433 (/home/aditya/.local/bin/mojo+0x3b3c433) #28 0x000055fa62d92096 (/home/aditya/.local/bin/mojo+0x3b3e096) #29 0x00007faa87e105b5 __libc_start_call_main (/lib64/libc.so.6+0x35b5) #30 0x00007faa87e10668 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x3668) #31 0x000055fa62d69725 (/home/aditya/.local/bin/mojo+0x3b15725)
$ mojo --no-optimization -D CRASH two.mojo /home/aditya/Projects/modular/crashes/reflection/two.mojo:25:4: error: function instantiation failed fn main(): ^ /home/aditya/Projects/modular/crashes/reflection/two.mojo:31:5: note: call expansion failed with parameter value(s): (...) elif is_defined["CRASH"](): ^ open-source/max/mojo/stdlib/std/reflection/reflection.mojo:331:4: note: function instantiation failed open-source/max/mojo/stdlib/std/reflection/reflection.mojo:368:12: note: could not simplify operator apply(:(i1) -> i1 @"two::B::__init__(::Bool)", 1) /home/aditya/.local/bin/mojo: error: failed to run the pass manager
$ mojo -D S two.mojo two.A[<unprintable>, <unprintable>]
$ mojo -D S --no-optimization two.mojo /home/aditya/Projects/modular/crashes/reflection/two.mojo:25:4: error: function instantiation failed fn main(): ^ /home/aditya/Projects/modular/crashes/reflection/two.mojo:27:5: note: call expansion failed with parameter value(s): (...) if is_defined["S"](): ^ open-source/max/mojo/stdlib/std/reflection/reflection.mojo:331:4: note: function instantiation failed open-source/max/mojo/stdlib/std/reflection/reflection.mojo:368:12: note: could not simplify operator apply(:(i1) -> i1 @"two::B::__init__(::Bool)", 1) /home/aditya/.local/bin/mojo: error: failed to run the pass manager
$ mojo -D T two.mojo /home/aditya/Projects/modular/crashes/reflection/two.mojo:25:4: error: function instantiation failed fn main(): ^ /home/aditya/Projects/modular/crashes/reflection/two.mojo:30:56: note: call expansion failed with parameter value(s): (..., ...) print(get_type_name[struct_field_types[T]()[0]]()) ^ /home/aditya/Projects/modular/crashes/reflection/two.mojo:4:8: note: function instantiation failed struct A[T: Movable, //, foo: Optional[T]]: ... ^ /home/aditya/Projects/modular/crashes/reflection/two.mojo:4:8: note: failed to compile-time evaluate function call open-source/max/mojo/stdlib/std/collections/optional.mojo:140:8: note: struct not a writeable type, got #kgen.param.expr<apply_result_slot, #kgen.symbol.constant<@"two::C::__init__(::Bool)"> : !kgen.generator<(i1, !kgen.pointer<struct<(i1) memoryOnly>> byref_result) -> !kgen.none>, true> : !kgen.struct<(i1) memoryOnly> instead /home/aditya/.local/bin/mojo: error: failed to run the pass manager
$ mojo -D T --no-optimization two.mojo /home/aditya/Projects/modular/crashes/reflection/two.mojo:25:4: error: function instantiation failed fn main(): ^ /home/aditya/Projects/modular/crashes/reflection/two.mojo:29:5: note: call expansion failed with parameter value(s): (...) elif is_defined["T"](): ^ open-source/max/mojo/stdlib/std/reflection/reflection.mojo:331:4: note: function instantiation failed open-source/max/mojo/stdlib/std/reflection/reflection.mojo:368:12: note: could not simplify operator apply_result_slot(:(i1, !kgen.pointer<struct<(i1) memoryOnly>> byref_result) -> !kgen.none @"two::C::__init__(::Bool)", 1) /home/aditya/.local/bin/mojo: error: failed to run the pass manager
System information
$ pixi info
System
------------
Pixi version: 0.60.0
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=6.17.12=0
: __glibc=2.42=0
: __cuda=13.0=0
: __archspec=1=skylake
Cache dir: /home/aditya/.cache/rattler/cache
Auth storage: /home/aditya/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /home/aditya/.local/share/pixi/bin
Environment dir: /home/aditya/.local/share/pixi/envs
Manifest dir: /home/aditya/.local/share/pixi/manifests/pixi-global.toml
Workspace
------------
Name: Mojo
Manifest file: /home/aditya/Projects/modular/mojo/pixi.toml
Last updated: 03-01-2026 11:43:06
Environments
------------
Environment: default
Features: default
Channels: conda-forge, https://conda.modular.com/max-nightly
Dependency count: 1
Dependencies: mojo
Target platforms: osx-arm64, linux-aarch64, linux-64
Prefix location: /home/aditya/Projects/modular/mojo/.pixi/envs/default
Tasks: format, tests$ mojo --version
Mojo 0.26.1.0.dev2026010223 (75347503)Metadata
Metadata
Assignees
Labels
Team: Mojo LibrariesRelevant to the Mojo libraries team, which will review and decide on the issue or PR.Relevant to the Mojo libraries team, which will review and decide on the issue or PR.bugSomething isn't workingSomething isn't workingmojoIssues that are related to mojoIssues that are related to mojo