File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
godot-codegen/src/generator Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ pub fn make_virtual_methods_trait(
2323 view : & ApiView ,
2424) -> TokenStream {
2525 let trait_name = ident ( trait_name_str) ;
26+ let class_name = & class. name ( ) . rust_ty ;
2627
2728 let virtual_method_fns = make_all_virtual_methods ( class, all_base_names, view) ;
2829 let special_virtual_methods = make_special_virtual_methods ( notification_enum_name) ;
@@ -34,7 +35,7 @@ pub fn make_virtual_methods_trait(
3435 #[ allow( unused_variables) ]
3536 #[ allow( clippy:: unimplemented) ]
3637 #cfg_attributes
37- pub trait #trait_name: crate :: obj:: GodotClass + crate :: private:: You_forgot_the_attribute__godot_api {
38+ pub trait #trait_name: crate :: obj:: GodotClass < Base = #class_name> + crate :: private:: You_forgot_the_attribute__godot_api {
3839 #special_virtual_methods
3940 #( #virtual_method_fns ) *
4041 }
Original file line number Diff line number Diff line change @@ -547,6 +547,21 @@ pub fn derive_godot_class(input: TokenStream) -> TokenStream {
547547/// }
548548/// ```
549549///
550+ /// Using _any_ trait other than the one corresponding with the base class will result in compilation failure.
551+ ///
552+ /// ```compile_fail
553+ /// # use godot::prelude::*;
554+ /// #[derive(GodotClass)]
555+ /// #[class(init, base=Node3D)]
556+ /// pub struct My3DNode;
557+ ///
558+ /// #[godot_api]
559+ /// impl INode for My3DNode {
560+ /// fn ready(&mut self) {
561+ /// godot_print!("Hello World!");
562+ /// }
563+ /// }
564+ /// ```
550565///
551566/// # User-defined functions
552567///
You can’t perform that action at this time.
0 commit comments