slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.55k stars 601 forks source link

Language server crash with: `called with not an alias?` #3674

Closed plule closed 1 year ago

plule commented 1 year ago

There is a reproducible crash in the language server.

Observe the server crash with the following stacktrace:

thread 'main' panicked at 'called with not an alias?', internal\compiler\passes\infer_aliases_types.rs:66:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library\std\src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library\core\src/panicking.rs:67:14
   2: i_slint_compiler::passes::infer_aliases_types::resolve_alias
   3: i_slint_compiler::passes::infer_aliases_types::resolve_alias
   4: i_slint_compiler::object_tree::recurse_elem_no_borrow
   5: i_slint_compiler::passes::run_import_passes
   6: slint_interpreter::dynamic_component::load::{{closure}}
   7: slint_lsp::preview::native::load_preview::{{closure}}::{{closure}}
   8: core::ops::function::FnOnce::call_once{{vtable.shim}}
   9: i_slint_backend_winit::event_loop::CURRENT_WINDOW_TARGET::<impl i_slint_backend_winit::event_loop::CURRENT_WINDOW_TARGET>::set
  10: winit::platform_impl::platform::event_loop::EventLoop<T>::run_return::{{closure}}
  11: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::catch_unwind
  12: winit::platform_impl::platform::event_loop::runner::EventLoopRunner<T>::send_event
  13: winit::platform_impl::platform::event_loop::thread_event_target_callback
  14: <unknown>
  15: <unknown>
  16: <i_slint_backend_winit::Backend as i_slint_core::platform::Platform>::run_event_loop
  17: slint_lsp::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 8:13:36 AM] Connection to server got closed. Server will restart.
The Slint Language Server crashed. This is a bug.
Please open an issue on https://github.com/slint-ui/slint/issues
ogoffart commented 1 year ago

Thanks for the bug report!
I can reproduce the problem. Looks like a bug in the alias resolution when the alias is in a component with error.

plule commented 1 year ago

Thank you for looking into it :) I’ve not been able to have a minimal reproduction yet, but I think it's related to when the property type is omitted in an alias chain