diff --git a/examples/carousel/ui/carousel_demo.slint b/examples/carousel/ui/carousel_demo.slint index 45fbdd3d1cb..4d5c3900b7e 100644 --- a/examples/carousel/ui/carousel_demo.slint +++ b/examples/carousel/ui/carousel_demo.slint @@ -5,7 +5,7 @@ import { Carousel } from "carousel.slint"; import { Card } from "card.slint"; import { Theme } from "theme.slint"; -component MainWindow inherits Window { +export component MainWindow inherits Window { private property<[{ title: string, image: image}]> navigation-items: [ { title: "Settings", image: @image-url("svg/settings_black.svg") }, { title: "Home", image: @image-url("svg/home_black.svg") }, @@ -38,4 +38,4 @@ component MainWindow inherits Window { clicked => { root.selected-index = index; } } } -} \ No newline at end of file +} diff --git a/examples/gallery/ui/gallery_settings.slint b/examples/gallery/ui/gallery_settings.slint index b1b391bc32d..749e1aa0cf1 100644 --- a/examples/gallery/ui/gallery_settings.slint +++ b/examples/gallery/ui/gallery_settings.slint @@ -1,6 +1,6 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -global GallerySettings { +export global GallerySettings { in property widgets-disabled: false; -} \ No newline at end of file +} diff --git a/examples/opengl_underlay/scene.slint b/examples/opengl_underlay/scene.slint index 5806208ce34..7774c5696fc 100644 --- a/examples/opengl_underlay/scene.slint +++ b/examples/opengl_underlay/scene.slint @@ -4,7 +4,7 @@ import { ScrollView, Button, CheckBox, SpinBox, Slider, GroupBox, LineEdit, StandardListView, ComboBox, HorizontalBox, VerticalBox, GridBox, TabWidget, TextEdit, AboutSixtyFPS } from "std-widgets.slint"; -component App inherits Window { +export component App inherits Window { preferred-width: 500px; preferred-height: 600px; title: "Slint OpenGL Underlay Example"; diff --git a/examples/printerdemo_old/ui/print_page.slint b/examples/printerdemo_old/ui/print_page.slint index 7c746811129..86c3a63c32a 100644 --- a/examples/printerdemo_old/ui/print_page.slint +++ b/examples/printerdemo_old/ui/print_page.slint @@ -4,7 +4,7 @@ import { SpinBox, Button, CheckBox, Slider, GroupBox, StandardListView, GridBox } from "std-widgets.slint"; import { Label, Page, Preview } from "common.slint"; -component PrintPage inherits Page { +export component PrintPage inherits Page { layout := GridLayout { padding-left: 40px; diff --git a/examples/printerdemo_old/ui/printerdemo.slint b/examples/printerdemo_old/ui/printerdemo.slint index 26246dd96f7..a3ec8fae4c9 100644 --- a/examples/printerdemo_old/ui/printerdemo.slint +++ b/examples/printerdemo_old/ui/printerdemo.slint @@ -54,7 +54,7 @@ struct InkLevel { level: float, } -component MainWindow inherits Window { +export component MainWindow inherits Window { callback quit(); width: 800px; diff --git a/internal/compiler/object_tree.rs b/internal/compiler/object_tree.rs index 548a470c89c..f01eab5f9a0 100644 --- a/internal/compiler/object_tree.rs +++ b/internal/compiler/object_tree.rs @@ -200,7 +200,7 @@ pub struct UsedSubTypes { /// Or is materialized for repeated expression. #[derive(Default, Debug)] pub struct Component { - // node: SyntaxNode, + pub node: Option, pub id: String, pub root_element: ElementRc, @@ -254,6 +254,7 @@ impl Component { let mut child_insertion_point = None; let is_legacy_syntax = node.child_token(SyntaxKind::ColonEqual).is_some(); let c = Component { + node: Some(node.clone().into()), id: parser::identifier_text(&node.DeclaredIdentifier()).unwrap_or_default(), root_element: Element::from_node( node.Element(), @@ -2215,6 +2216,15 @@ impl Exports { if sorted_deduped_exports.is_empty() { if let Some(last_compo) = inner_components.last() { + if last_compo.is_global() { + diag.push_warning( + "Global singleton is implicitly marked for export. This is deprecated and it should be explicitly exported" + .into(), + &last_compo.node, + ); + } else { + diag.push_warning("Component is implicitly marked for export. This is deprecated and it should be explicitly exported".into(), &last_compo.node) + } let name = last_compo.id.clone(); sorted_deduped_exports.push(( ExportedName { name, name_ident: doc.clone().into() }, diff --git a/internal/compiler/passes/inlining.rs b/internal/compiler/passes/inlining.rs index 9936374d386..cfff1e1600a 100644 --- a/internal/compiler/passes/inlining.rs +++ b/internal/compiler/passes/inlining.rs @@ -268,6 +268,7 @@ fn duplicate_sub_component( ) -> Rc { debug_assert!(component_to_duplicate.parent_element.upgrade().is_some()); let new_component = Component { + node: component_to_duplicate.node.clone(), id: component_to_duplicate.id.clone(), root_element: duplicate_element_with_mapping( &component_to_duplicate.root_element, diff --git a/internal/compiler/tests/syntax/accessibility/accessible_properties.slint b/internal/compiler/tests/syntax/accessibility/accessible_properties.slint index b995323368d..92e035b3f35 100644 --- a/internal/compiler/tests/syntax/accessibility/accessible_properties.slint +++ b/internal/compiler/tests/syntax/accessibility/accessible_properties.slint @@ -19,7 +19,7 @@ Button3 := Rectangle { } } -Test := Window { +export Test := Window { Button1 { } Button1 { accessible-description: "ok"; } // ok because Button1 has a role diff --git a/internal/compiler/tests/syntax/analysis/binding_loop1.slint b/internal/compiler/tests/syntax/analysis/binding_loop1.slint index c320d25f948..d2fd31ffbf0 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop1.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop1.slint @@ -14,7 +14,7 @@ WithStates := Rectangle { ] } -Test := Rectangle { +export Test := Rectangle { property a: 45 + root.b; // ^error{The binding for the property 'a' is part of a binding loop} diff --git a/internal/compiler/tests/syntax/analysis/binding_loop2.slint b/internal/compiler/tests/syntax/analysis/binding_loop2.slint index eeed8554660..fe221360347 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop2.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop2.slint @@ -35,7 +35,7 @@ T4 := Rectangle { property my_property <=> x; } -App := Rectangle { +export App := Rectangle { VerticalLayout { diff --git a/internal/compiler/tests/syntax/analysis/binding_loop_function.slint b/internal/compiler/tests/syntax/analysis/binding_loop_function.slint index 0d4043dd80a..4112f3a5537 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop_function.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop_function.slint @@ -18,7 +18,7 @@ Compo1 := Rectangle { // ^error{The binding for the property 'bb' is part of a binding loop} } -App := Rectangle { +export App := Rectangle { cc := Compo1 { aa() => { return self.a; } // ^error{The binding for the property 'aa' is part of a binding loop} @@ -29,4 +29,4 @@ App := Rectangle { -} \ No newline at end of file +} diff --git a/internal/compiler/tests/syntax/analysis/binding_loop_issue_772.slint b/internal/compiler/tests/syntax/analysis/binding_loop_issue_772.slint index 86d0da45450..dd4aafafe74 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop_issue_772.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop_issue_772.slint @@ -6,7 +6,7 @@ Alias := Rectangle { property ps_width <=> viewport_width; } -Foo := Rectangle { +export Foo := Rectangle { property base-prop: alias.viewport_width; // ^error{The binding for the property 'base-prop' is part of a binding loop} diff --git a/internal/compiler/tests/syntax/analysis/binding_loop_layout.slint b/internal/compiler/tests/syntax/analysis/binding_loop_layout.slint index 0461407434d..b56772fafad 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop_layout.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop_layout.slint @@ -19,7 +19,7 @@ TC := Rectangle { } -Test := Rectangle { +export Test := Rectangle { VerticalLayout { // ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} // FIXME: That's an internal property, but people might understand // ^^error{The binding for the property 'min-width' is part of a binding loop} diff --git a/internal/compiler/tests/syntax/analysis/binding_loop_layout2.slint b/internal/compiler/tests/syntax/analysis/binding_loop_layout2.slint index 7ad788c8934..d4bf1142512 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop_layout2.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop_layout2.slint @@ -26,7 +26,7 @@ Wrap := Rectangle { property test: square.width == square.height; } -Test := Rectangle { +export Test := Rectangle { property source; GridLayout { // ^error{The binding for the property 'layout-cache-h' is part of a binding loop} diff --git a/internal/compiler/tests/syntax/analysis/binding_loop_layout3.slint b/internal/compiler/tests/syntax/analysis/binding_loop_layout3.slint index d37e995c26d..627653258dd 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop_layout3.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop_layout3.slint @@ -22,7 +22,7 @@ Compo := Rectangle { } -Foo := Rectangle { +export Foo := Rectangle { Compo { // ^error{The binding for the property 'preferred-width' is part of a binding loop} the_text: self.preferred-width / 1px; diff --git a/internal/compiler/tests/syntax/analysis/binding_loop_self.slint b/internal/compiler/tests/syntax/analysis/binding_loop_self.slint index dfb6a8cf95c..8cab7da414a 100644 --- a/internal/compiler/tests/syntax/analysis/binding_loop_self.slint +++ b/internal/compiler/tests/syntax/analysis/binding_loop_self.slint @@ -5,7 +5,7 @@ Key := Rectangle { property pos; property num_elements; } -Test := Rectangle { +export Test := Rectangle { Rectangle { property num_elements; num-elements: 4; diff --git a/internal/compiler/tests/syntax/basic/animate.slint b/internal/compiler/tests/syntax/basic/animate.slint index 49a2418e47e..f1b8c377376 100644 --- a/internal/compiler/tests/syntax/basic/animate.slint +++ b/internal/compiler/tests/syntax/basic/animate.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { animate x { duration: 1000ms; diff --git a/internal/compiler/tests/syntax/basic/arithmetic_op.slint b/internal/compiler/tests/syntax/basic/arithmetic_op.slint index 2bfffcab865..7b8d8f26170 100644 --- a/internal/compiler/tests/syntax/basic/arithmetic_op.slint +++ b/internal/compiler/tests/syntax/basic/arithmetic_op.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { property p1: 3s + 1ms; property p2: 3s + 1; // ^error{Cannot convert float to duration} diff --git a/internal/compiler/tests/syntax/basic/array.slint b/internal/compiler/tests/syntax/basic/array.slint index 27d64606663..e7554769d76 100644 --- a/internal/compiler/tests/syntax/basic/array.slint +++ b/internal/compiler/tests/syntax/basic/array.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Test := Window { +export Test := Window { a: [,]; // ^error{invalid expression} } diff --git a/internal/compiler/tests/syntax/basic/assign.slint b/internal/compiler/tests/syntax/basic/assign.slint index db85daee048..53880550d2a 100644 --- a/internal/compiler/tests/syntax/basic/assign.slint +++ b/internal/compiler/tests/syntax/basic/assign.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { TouchArea { clicked => { root.x = 1phx; } } diff --git a/internal/compiler/tests/syntax/basic/box_shadow.slint b/internal/compiler/tests/syntax/basic/box_shadow.slint index dc6d76b0501..b02c61b0c60 100644 --- a/internal/compiler/tests/syntax/basic/box_shadow.slint +++ b/internal/compiler/tests/syntax/basic/box_shadow.slint @@ -5,7 +5,7 @@ Foo := Rectangle { drop-shadow-color: red; } -SuperSimple := Window { +export SuperSimple := Window { drop-shadow-color: #00000080; // ^warning{The drop-shadow-color property cannot be used on the root element, the shadow will not be visible} diff --git a/internal/compiler/tests/syntax/basic/children_placeholder.slint b/internal/compiler/tests/syntax/basic/children_placeholder.slint index ee885eac33d..11a5bc04275 100644 --- a/internal/compiler/tests/syntax/basic/children_placeholder.slint +++ b/internal/compiler/tests/syntax/basic/children_placeholder.slint @@ -33,7 +33,7 @@ TestBox2 := Rectangle { // ^error{The @children placeholder can only appear once in an element hierarchy} } -Final := TestBox { +export Final := TestBox { Rectangle { @children // ^error{children placeholder not allowed in the final component} diff --git a/internal/compiler/tests/syntax/basic/children_placeholder_2.slint b/internal/compiler/tests/syntax/basic/children_placeholder_2.slint index 58182e32a81..85429e41fdc 100644 --- a/internal/compiler/tests/syntax/basic/children_placeholder_2.slint +++ b/internal/compiler/tests/syntax/basic/children_placeholder_2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Final := Window { +export Final := Window { VerticalLayout { @children // ^error{children placeholder not allowed in the final component} diff --git a/internal/compiler/tests/syntax/basic/clip.slint b/internal/compiler/tests/syntax/basic/clip.slint index 24e191b75a3..eb399a114c0 100644 --- a/internal/compiler/tests/syntax/basic/clip.slint +++ b/internal/compiler/tests/syntax/basic/clip.slint @@ -3,7 +3,7 @@ MyTouchArea := TouchArea { } -SubElements := Rectangle { +export SubElements := Rectangle { Rectangle { clip: 42; // ^error{Cannot convert float to bool} diff --git a/internal/compiler/tests/syntax/basic/comments.slint b/internal/compiler/tests/syntax/basic/comments.slint index fee2540fa24..325aa7da412 100644 --- a/internal/compiler/tests/syntax/basic/comments.slint +++ b/internal/compiler/tests/syntax/basic/comments.slint @@ -4,7 +4,7 @@ // comment // line comment -SuperSimple := Rectangle { +export SuperSimple := Rectangle { /* block comment */ background: green; diff --git a/internal/compiler/tests/syntax/basic/comparison_operator.slint b/internal/compiler/tests/syntax/basic/comparison_operator.slint index 51dfa35357f..9c16ec2cf32 100644 --- a/internal/compiler/tests/syntax/basic/comparison_operator.slint +++ b/internal/compiler/tests/syntax/basic/comparison_operator.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { property zz: aa > bb == cc // ^error{Use parentheses to disambiguate equality expression on the same level} < dd; diff --git a/internal/compiler/tests/syntax/basic/condition_operator.slint b/internal/compiler/tests/syntax/basic/condition_operator.slint index b58ef531d5d..f47ea4780aa 100644 --- a/internal/compiler/tests/syntax/basic/condition_operator.slint +++ b/internal/compiler/tests/syntax/basic/condition_operator.slint @@ -26,7 +26,7 @@ SuperSimple := Rectangle { } -Test2 := Rectangle { +export Test2 := Rectangle { background: { // ^error{Cannot convert void to brush} if (true) { diff --git a/internal/compiler/tests/syntax/basic/dialog.slint b/internal/compiler/tests/syntax/basic/dialog.slint index 6fcea6f9e6f..1f236cc8187 100644 --- a/internal/compiler/tests/syntax/basic/dialog.slint +++ b/internal/compiler/tests/syntax/basic/dialog.slint @@ -47,7 +47,7 @@ MyDialog4 := Dialog { } } -Test := Rectangle { +export Test := Rectangle { MyDiag1 {} MyDiag2 {} MyDiag3 {} diff --git a/internal/compiler/tests/syntax/basic/dialog2.slint b/internal/compiler/tests/syntax/basic/dialog2.slint index 3d468260b19..c18451e49f0 100644 --- a/internal/compiler/tests/syntax/basic/dialog2.slint +++ b/internal/compiler/tests/syntax/basic/dialog2.slint @@ -3,8 +3,8 @@ import { StandardButton } from "std-widgets.slint"; -Test := Dialog { -// ^error{A Dialog must have a single child element that is not StandardButton} +export Test := Dialog { +// ^error{A Dialog must have a single child element that is not StandardButton} StandardButton { kind: ok; } StandardButton { } // ^error{The `kind` property of the StandardButton in a Dialog must be set} diff --git a/internal/compiler/tests/syntax/basic/double_binding.slint b/internal/compiler/tests/syntax/basic/double_binding.slint index 4acc0264a20..4673e765776 100644 --- a/internal/compiler/tests/syntax/basic/double_binding.slint +++ b/internal/compiler/tests/syntax/basic/double_binding.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { x: 42phx; x: 32phx; diff --git a/internal/compiler/tests/syntax/basic/double_color.slint b/internal/compiler/tests/syntax/basic/double_color.slint index a2919028820..b7d299efe07 100644 --- a/internal/compiler/tests/syntax/basic/double_color.slint +++ b/internal/compiler/tests/syntax/basic/double_color.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { background: green; background: red; // ^error{Duplicated property} diff --git a/internal/compiler/tests/syntax/basic/duplicated_id.slint b/internal/compiler/tests/syntax/basic/duplicated_id.slint index 0c00e021aba..91d627dd431 100644 --- a/internal/compiler/tests/syntax/basic/duplicated_id.slint +++ b/internal/compiler/tests/syntax/basic/duplicated_id.slint @@ -26,7 +26,7 @@ SubElement := Rectangle { // ^error{duplicated element id 'hello'} } -TestCase := Rectangle { +export TestCase := Rectangle { unique := Rectangle { foo := SubElement { } diff --git a/internal/compiler/tests/syntax/basic/easing.slint b/internal/compiler/tests/syntax/basic/easing.slint index 84dc26238c8..e543f200da4 100644 --- a/internal/compiler/tests/syntax/basic/easing.slint +++ b/internal/compiler/tests/syntax/basic/easing.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { animate x { easing: ease-in; } animate y { easing: foo; } // ^error{Unknown unqualified identifier 'foo'} diff --git a/internal/compiler/tests/syntax/basic/easing_not_called.slint b/internal/compiler/tests/syntax/basic/easing_not_called.slint index 76fc2df04d5..148e0cad9ba 100644 --- a/internal/compiler/tests/syntax/basic/easing_not_called.slint +++ b/internal/compiler/tests/syntax/basic/easing_not_called.slint @@ -3,7 +3,7 @@ // Cannot be put in the easing.slint test because it is in a different pass -X := Rectangle { +export X := Rectangle { property g; animate g { easing: cubic-bezier; } // ^error{must be called} } diff --git a/internal/compiler/tests/syntax/basic/for.slint b/internal/compiler/tests/syntax/basic/for.slint index da94bdc43d6..e65526d35f9 100644 --- a/internal/compiler/tests/syntax/basic/for.slint +++ b/internal/compiler/tests/syntax/basic/for.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { background: green; for xx Text {} diff --git a/internal/compiler/tests/syntax/basic/image.slint b/internal/compiler/tests/syntax/basic/image.slint index e2130d5f991..b4f1b887bdd 100644 --- a/internal/compiler/tests/syntax/basic/image.slint +++ b/internal/compiler/tests/syntax/basic/image.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SubElements := Rectangle { +export SubElements := Rectangle { background: blue; diff --git a/internal/compiler/tests/syntax/basic/inline_component.slint b/internal/compiler/tests/syntax/basic/inline_component.slint index 72c05580f45..12680057a1d 100644 --- a/internal/compiler/tests/syntax/basic/inline_component.slint +++ b/internal/compiler/tests/syntax/basic/inline_component.slint @@ -7,7 +7,7 @@ Inline1 := Rectangle { } } -SubElements := Rectangle { +export SubElements := Rectangle { Inline1 { background: yellow; invalid: yellow; diff --git a/internal/compiler/tests/syntax/basic/item_as_property.slint b/internal/compiler/tests/syntax/basic/item_as_property.slint index ea6fe3e9648..d0ac5b0b319 100644 --- a/internal/compiler/tests/syntax/basic/item_as_property.slint +++ b/internal/compiler/tests/syntax/basic/item_as_property.slint @@ -19,7 +19,7 @@ Comp := Rectangle { // ^error{'Rectangle' is not a valid type} } -Foo := Rectangle { +export Foo := Rectangle { xx := Rectangle { } Comp { r: xx; diff --git a/internal/compiler/tests/syntax/basic/layout.slint b/internal/compiler/tests/syntax/basic/layout.slint index 9ee4e7e7ddd..8ca9fa9bf46 100644 --- a/internal/compiler/tests/syntax/basic/layout.slint +++ b/internal/compiler/tests/syntax/basic/layout.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { lay := GridLayout { property foo: "hello"; diff --git a/internal/compiler/tests/syntax/basic/layout2.slint b/internal/compiler/tests/syntax/basic/layout2.slint index 6949d5f1ae9..3eeef103ad0 100644 --- a/internal/compiler/tests/syntax/basic/layout2.slint +++ b/internal/compiler/tests/syntax/basic/layout2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { lay := GridLayout { property foo: "hello"; diff --git a/internal/compiler/tests/syntax/basic/linear-gradient.slint b/internal/compiler/tests/syntax/basic/linear-gradient.slint index ba71a13e564..b27ecffa3e4 100644 --- a/internal/compiler/tests/syntax/basic/linear-gradient.slint +++ b/internal/compiler/tests/syntax/basic/linear-gradient.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { property g1: @linear-gradient(); // ^error{Expected angle expression} property g2: @linear-gradient(to left, blue, red); diff --git a/internal/compiler/tests/syntax/basic/minmax.slint b/internal/compiler/tests/syntax/basic/minmax.slint index f22d2e56e49..757d3d8c743 100644 --- a/internal/compiler/tests/syntax/basic/minmax.slint +++ b/internal/compiler/tests/syntax/basic/minmax.slint @@ -6,7 +6,7 @@ global Plop := { // ^error{Builtin function must be called} } -SuperSimple := Rectangle { +export SuperSimple := Rectangle { property a: max + max() + max(45, "hello"); // ^error{Builtin function must be called} // ^^error{Needs at least one argument} diff --git a/internal/compiler/tests/syntax/basic/object_in_binding.slint b/internal/compiler/tests/syntax/basic/object_in_binding.slint index 8f45af1444b..be48e017d78 100644 --- a/internal/compiler/tests/syntax/basic/object_in_binding.slint +++ b/internal/compiler/tests/syntax/basic/object_in_binding.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -H := Rectangle { +export H := Rectangle { x: {foo: "42"}; // ^error{Cannot convert \{ foo: string,\} to length} y: [ 45, 45, 45, 45 ]; diff --git a/internal/compiler/tests/syntax/basic/opacity.slint b/internal/compiler/tests/syntax/basic/opacity.slint index fbec50554b9..6ccd6b88d18 100644 --- a/internal/compiler/tests/syntax/basic/opacity.slint +++ b/internal/compiler/tests/syntax/basic/opacity.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Window { +export SuperSimple := Window { opacity: 0.5; // ^warning{The opacity property cannot be used on the root element, it will not be applied} diff --git a/internal/compiler/tests/syntax/basic/parse_error.slint b/internal/compiler/tests/syntax/basic/parse_error.slint index 01dcdbb1ee9..bb879727703 100644 --- a/internal/compiler/tests/syntax/basic/parse_error.slint +++ b/internal/compiler/tests/syntax/basic/parse_error.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { 88; // ^error{Parse error} * / - + // no error there as this is already reported in the previous line diff --git a/internal/compiler/tests/syntax/basic/path.slint b/internal/compiler/tests/syntax/basic/path.slint index 6bea8050ddb..70d56683db2 100644 --- a/internal/compiler/tests/syntax/basic/path.slint +++ b/internal/compiler/tests/syntax/basic/path.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { Path { LineTo { x: 100; y: 0; } LineTo { x: 100; y: 0; } diff --git a/internal/compiler/tests/syntax/basic/path_commands.slint b/internal/compiler/tests/syntax/basic/path_commands.slint index 596f6b96fad..9c5b168a939 100644 --- a/internal/compiler/tests/syntax/basic/path_commands.slint +++ b/internal/compiler/tests/syntax/basic/path_commands.slint @@ -8,7 +8,7 @@ Test2 := Path { // ^error{Error parsing SVG commands} } -TestCase := Rectangle { +export TestCase := Rectangle { Path { width: 100px; height: 100px; diff --git a/internal/compiler/tests/syntax/basic/path_for.slint b/internal/compiler/tests/syntax/basic/path_for.slint index 5c1ad0da3c7..632e464537c 100644 --- a/internal/compiler/tests/syntax/basic/path_for.slint +++ b/internal/compiler/tests/syntax/basic/path_for.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { Path { MoveTo { x: 0; diff --git a/internal/compiler/tests/syntax/basic/percent.slint b/internal/compiler/tests/syntax/basic/percent.slint index 79a9a9d8b8e..6c25870d010 100644 --- a/internal/compiler/tests/syntax/basic/percent.slint +++ b/internal/compiler/tests/syntax/basic/percent.slint @@ -12,7 +12,7 @@ Foo := Rectangle { // ^error{conversion from percentage to length is only possible for the properties width and height} } -X := Rectangle { +export X := Rectangle { height: 30%; // ^error{Cannot find parent property to apply relative length} Foo { diff --git a/internal/compiler/tests/syntax/basic/popup.slint b/internal/compiler/tests/syntax/basic/popup.slint index 144183b519d..eb1dccc51f2 100644 --- a/internal/compiler/tests/syntax/basic/popup.slint +++ b/internal/compiler/tests/syntax/basic/popup.slint @@ -2,8 +2,8 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := PopupWindow { -// ^error{PopupWindow cannot be the top level} +export X := PopupWindow { +// ^error{PopupWindow cannot be the top level} Rectangle { diff --git a/internal/compiler/tests/syntax/basic/property_animation.slint b/internal/compiler/tests/syntax/basic/property_animation.slint index b4540355424..b4b0f43c9c6 100644 --- a/internal/compiler/tests/syntax/basic/property_animation.slint +++ b/internal/compiler/tests/syntax/basic/property_animation.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { animate x { duration: 1000ms; } diff --git a/internal/compiler/tests/syntax/basic/property_declaration.slint b/internal/compiler/tests/syntax/basic/property_declaration.slint index 4ada0504ae9..143e511cb9a 100644 --- a/internal/compiler/tests/syntax/basic/property_declaration.slint +++ b/internal/compiler/tests/syntax/basic/property_declaration.slint @@ -5,7 +5,7 @@ Comp := Rectangle { callback pressed; } -Test := Comp { +export Test := Comp { property foo; foo: 100; property bar; diff --git a/internal/compiler/tests/syntax/basic/property_declaration_in_component.slint b/internal/compiler/tests/syntax/basic/property_declaration_in_component.slint index 1601f499f80..182947eba36 100644 --- a/internal/compiler/tests/syntax/basic/property_declaration_in_component.slint +++ b/internal/compiler/tests/syntax/basic/property_declaration_in_component.slint @@ -5,7 +5,7 @@ Comp := Rectangle { property prop; } -Test := Rectangle { +export Test := Rectangle { Comp { prop: 45; } diff --git a/internal/compiler/tests/syntax/basic/radial-gradient.slint b/internal/compiler/tests/syntax/basic/radial-gradient.slint index 7de92789682..f05e90f1089 100644 --- a/internal/compiler/tests/syntax/basic/radial-gradient.slint +++ b/internal/compiler/tests/syntax/basic/radial-gradient.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { property g1: @radial-gradient(); // ^error{Expected 'circle': currently, only @radial-gradient\(circle, ...\) are supported} property g2: @radial-gradient(circle at 100%, #333, #333 50%, #eee 75%, #333 75%); diff --git a/internal/compiler/tests/syntax/basic/return.slint b/internal/compiler/tests/syntax/basic/return.slint index 3bb609d327f..5ec2255b444 100644 --- a/internal/compiler/tests/syntax/basic/return.slint +++ b/internal/compiler/tests/syntax/basic/return.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { background: { return 42; // ^error{Cannot convert float to brush} diff --git a/internal/compiler/tests/syntax/basic/rotation.slint b/internal/compiler/tests/syntax/basic/rotation.slint index eeb3eccdbcc..c2ef1ca634c 100644 --- a/internal/compiler/tests/syntax/basic/rotation.slint +++ b/internal/compiler/tests/syntax/basic/rotation.slint @@ -47,7 +47,7 @@ Ex2 := Rectangle { } -Ex3 := Rectangle { +export Ex3 := Rectangle { i1 := Image { // ^error{Elements with rotation properties cannot have children elements} Rectangle {} diff --git a/internal/compiler/tests/syntax/basic/self_assign.slint b/internal/compiler/tests/syntax/basic/self_assign.slint index 90f438eb418..6f8736c9f05 100644 --- a/internal/compiler/tests/syntax/basic/self_assign.slint +++ b/internal/compiler/tests/syntax/basic/self_assign.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { TouchArea { clicked => { root.x += 1phx; } } diff --git a/internal/compiler/tests/syntax/basic/signal.slint b/internal/compiler/tests/syntax/basic/signal.slint index 6f06eaa4039..f7bc595b5b0 100644 --- a/internal/compiler/tests/syntax/basic/signal.slint +++ b/internal/compiler/tests/syntax/basic/signal.slint @@ -5,7 +5,7 @@ Base := Rectangle { callback blah; } -SubElements := Rectangle { +export SubElements := Rectangle { callback foobar; callback foobar; // ^error{Duplicated callback declaration} diff --git a/internal/compiler/tests/syntax/basic/states_transitions.slint b/internal/compiler/tests/syntax/basic/states_transitions.slint index 4321eca3f4f..157c42c192c 100644 --- a/internal/compiler/tests/syntax/basic/states_transitions.slint +++ b/internal/compiler/tests/syntax/basic/states_transitions.slint @@ -87,7 +87,7 @@ component NewSyntax { } -component OldInNewSyntax { +export component OldInNewSyntax { property checked; property border; property color; @@ -130,4 +130,4 @@ component OldInNewSyntax { text := Text {} touch := TouchArea {} -} \ No newline at end of file +} diff --git a/internal/compiler/tests/syntax/basic/states_transitions2.slint b/internal/compiler/tests/syntax/basic/states_transitions2.slint index 9ca577c8712..23bd3eceb3e 100644 --- a/internal/compiler/tests/syntax/basic/states_transitions2.slint +++ b/internal/compiler/tests/syntax/basic/states_transitions2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { property checked; property border; animate background { } diff --git a/internal/compiler/tests/syntax/basic/strings.slint b/internal/compiler/tests/syntax/basic/strings.slint index 725e5b7f820..d3e9217185f 100644 --- a/internal/compiler/tests/syntax/basic/strings.slint +++ b/internal/compiler/tests/syntax/basic/strings.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Test := Window { +export Test := Window { Text { text: "hel\lo"; // ^error{Cannot parse string literal} diff --git a/internal/compiler/tests/syntax/basic/sub_elements.slint b/internal/compiler/tests/syntax/basic/sub_elements.slint index 784148c3f6f..133009e69b4 100644 --- a/internal/compiler/tests/syntax/basic/sub_elements.slint +++ b/internal/compiler/tests/syntax/basic/sub_elements.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SubElements := Rectangle { +export SubElements := Rectangle { Rectangle { background: yellow; diff --git a/internal/compiler/tests/syntax/basic/supersimple.slint b/internal/compiler/tests/syntax/basic/supersimple.slint index 16a11a6571d..10e5922f4e1 100644 --- a/internal/compiler/tests/syntax/basic/supersimple.slint +++ b/internal/compiler/tests/syntax/basic/supersimple.slint @@ -2,6 +2,6 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -SuperSimple := Rectangle { +export SuperSimple := Rectangle { background: green; } diff --git a/internal/compiler/tests/syntax/basic/svg_path.slint b/internal/compiler/tests/syntax/basic/svg_path.slint index 3dccb26365a..23e2313f5da 100644 --- a/internal/compiler/tests/syntax/basic/svg_path.slint +++ b/internal/compiler/tests/syntax/basic/svg_path.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { Path { commands: "M 350 300 L 550 300 "; LineTo { x: 10; y: 100; } diff --git a/internal/compiler/tests/syntax/basic/type_declaration.slint b/internal/compiler/tests/syntax/basic/type_declaration.slint index b47eb2729cb..d2e5669f57e 100644 --- a/internal/compiler/tests/syntax/basic/type_declaration.slint +++ b/internal/compiler/tests/syntax/basic/type_declaration.slint @@ -30,7 +30,7 @@ global MyType := { } -SuperSimple := Rectangle { +export SuperSimple := Rectangle { MyType { // ^error{Cannot create an instance of a global component} ccc: "hello"; diff --git a/internal/compiler/tests/syntax/basic/unknown_item.slint b/internal/compiler/tests/syntax/basic/unknown_item.slint index f23c2aef64a..d87e2378020 100644 --- a/internal/compiler/tests/syntax/basic/unknown_item.slint +++ b/internal/compiler/tests/syntax/basic/unknown_item.slint @@ -3,7 +3,7 @@ struct Struct := { def: int, } -SuperSimple := Rectangle { +export SuperSimple := Rectangle { DoesNotExist { // ^error{Unknown type DoesNotExist} } diff --git a/internal/compiler/tests/syntax/callbacks/init.slint b/internal/compiler/tests/syntax/callbacks/init.slint index fc4b1dabd61..be7022a4eaa 100644 --- a/internal/compiler/tests/syntax/callbacks/init.slint +++ b/internal/compiler/tests/syntax/callbacks/init.slint @@ -8,7 +8,7 @@ global Singleton := { // ^error{A global component cannot have an 'init' callback} } -Test := Rectangle { +export Test := Rectangle { callback init; // ^error{Cannot override callback 'init'} } diff --git a/internal/compiler/tests/syntax/elements/listview.slint b/internal/compiler/tests/syntax/elements/listview.slint index 34df9f5b4c1..6abb21d10be 100644 --- a/internal/compiler/tests/syntax/elements/listview.slint +++ b/internal/compiler/tests/syntax/elements/listview.slint @@ -10,7 +10,7 @@ Foo := Rectangle { } } -Bar := Rectangle { +export Bar := Rectangle { Foo { Text {} } ListView { Text {} @@ -32,4 +32,4 @@ Bar := Rectangle { for x in 2: Rectangle {} // ^warning{A ListView can just have a single 'for' as children. Anything else is not supported} } -} \ No newline at end of file +} diff --git a/internal/compiler/tests/syntax/elements/tabwidget.slint b/internal/compiler/tests/syntax/elements/tabwidget.slint index 912ad698e4b..dc6c29281ba 100644 --- a/internal/compiler/tests/syntax/elements/tabwidget.slint +++ b/internal/compiler/tests/syntax/elements/tabwidget.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial import { TabWidget } from "std-widgets.slint"; -Test1 := Rectangle { +export Test1 := Rectangle { TabWidget { Rectangle {} // ^error{Rectangle is not allowed within TabWidget. Only Tab are valid children} diff --git a/internal/compiler/tests/syntax/elements/tabwidget2.slint b/internal/compiler/tests/syntax/elements/tabwidget2.slint index f181ea0e8fc..1107c4af396 100644 --- a/internal/compiler/tests/syntax/elements/tabwidget2.slint +++ b/internal/compiler/tests/syntax/elements/tabwidget2.slint @@ -3,7 +3,7 @@ import { TabWidget } from "std-widgets.slint"; -Test2 := Rectangle { +export Test2 := Rectangle { TabWidget { Tab { visible: false; diff --git a/internal/compiler/tests/syntax/elements/tabwidget3.slint b/internal/compiler/tests/syntax/elements/tabwidget3.slint index 9adf7e0bd52..b7ec0e63560 100644 --- a/internal/compiler/tests/syntax/elements/tabwidget3.slint +++ b/internal/compiler/tests/syntax/elements/tabwidget3.slint @@ -7,5 +7,5 @@ Test3 := Rectangle { } } -Foo := TabWidget { } -// ^error{Unknown type TabWidget. \(The type exist as an internal type, but cannot be accessed in this scope\)} +export Foo := TabWidget { } +// ^error{Unknown type TabWidget. \(The type exist as an internal type, but cannot be accessed in this scope\)} diff --git a/internal/compiler/tests/syntax/exports/root_compo_export.slint b/internal/compiler/tests/syntax/exports/root_compo_export.slint new file mode 100644 index 00000000000..a452b8fbfe7 --- /dev/null +++ b/internal/compiler/tests/syntax/exports/root_compo_export.slint @@ -0,0 +1,12 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial + +component Button { + +} + + component App { +//^warning{Component is implicitly marked for export. This is deprecated and it should be explicitly exported} + Button {} +} + diff --git a/internal/compiler/tests/syntax/exports/single_global_missing_export.slint b/internal/compiler/tests/syntax/exports/single_global_missing_export.slint new file mode 100644 index 00000000000..aad55e2be5c --- /dev/null +++ b/internal/compiler/tests/syntax/exports/single_global_missing_export.slint @@ -0,0 +1,7 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial + + global Settings { +//^warning{Global singleton is implicitly marked for export. This is deprecated and it should be explicitly exported} + in-out property active; +} diff --git a/internal/compiler/tests/syntax/focus/focus_invalid.slint b/internal/compiler/tests/syntax/focus/focus_invalid.slint index 74b67c6ad5f..47b66238190 100644 --- a/internal/compiler/tests/syntax/focus/focus_invalid.slint +++ b/internal/compiler/tests/syntax/focus/focus_invalid.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { forward-focus: nothingness; // ^error{Unknown unqualified identifier} } diff --git a/internal/compiler/tests/syntax/focus/focus_not_called.slint b/internal/compiler/tests/syntax/focus/focus_not_called.slint index 46bd03f75ba..23b192d8cf9 100644 --- a/internal/compiler/tests/syntax/focus/focus_not_called.slint +++ b/internal/compiler/tests/syntax/focus/focus_not_called.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { edit := TextInput { } TouchArea { clicked => { diff --git a/internal/compiler/tests/syntax/focus/initial_focus_non_input.slint b/internal/compiler/tests/syntax/focus/initial_focus_non_input.slint index 9dad287d58b..0c4d5f90c67 100644 --- a/internal/compiler/tests/syntax/focus/initial_focus_non_input.slint +++ b/internal/compiler/tests/syntax/focus/initial_focus_non_input.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { forward-focus: someRect; // ^error{element is not focusable} diff --git a/internal/compiler/tests/syntax/functions/functions.slint b/internal/compiler/tests/syntax/functions/functions.slint index 547072a7726..ec99275942c 100644 --- a/internal/compiler/tests/syntax/functions/functions.slint +++ b/internal/compiler/tests/syntax/functions/functions.slint @@ -7,7 +7,7 @@ Abc := Rectangle { function par() {} } -Xxx := Rectangle { +export Xxx := Rectangle { function fooo(a: int, a: int) -> int { return a; } // ^error{Duplicated argument name 'a'} diff --git a/internal/compiler/tests/syntax/functions/functions_call.slint b/internal/compiler/tests/syntax/functions/functions_call.slint index ea3e4a255f4..c99f583cfe0 100644 --- a/internal/compiler/tests/syntax/functions/functions_call.slint +++ b/internal/compiler/tests/syntax/functions/functions_call.slint @@ -10,7 +10,7 @@ Comp := Rectangle { public function f2() {} } -Xxx := Rectangle { +export Xxx := Rectangle { function foo(a: int) -> string { return a; } comp := Comp {} diff --git a/internal/compiler/tests/syntax/functions/functions_purity.slint b/internal/compiler/tests/syntax/functions/functions_purity.slint index d6f0de06701..e9159ccf4cc 100644 --- a/internal/compiler/tests/syntax/functions/functions_purity.slint +++ b/internal/compiler/tests/syntax/functions/functions_purity.slint @@ -138,7 +138,7 @@ Foo_Legacy := Rectangle { } -Bar_Legacy := Rectangle { +export Bar_Legacy := Rectangle { pure callback xc1 <=> f.c1; // ^error{Purity of callbacks 'xc1' and 'f.c1' doesn't match} callback xc2 <=> f.c2; @@ -149,4 +149,4 @@ Bar_Legacy := Rectangle { // ^warning{Call of impure callback 'c1'} } } -} \ No newline at end of file +} diff --git a/internal/compiler/tests/syntax/imports/cyclic_import.slint b/internal/compiler/tests/syntax/imports/cyclic_import.slint index 0cf4086ff55..2d5067fdfac 100644 --- a/internal/compiler/tests/syntax/imports/cyclic_import.slint +++ b/internal/compiler/tests/syntax/imports/cyclic_import.slint @@ -3,7 +3,7 @@ import { Rec12 } from "../../typeloader/recursive_import1.slint"; // ^error{No exported type called 'Rec12' found in ".*recursive_import1.slint"} -Blah := Rec12 { -// ^error{Unknown type Rec12} +export Blah := Rec12 { +// ^error{Unknown type Rec12} width: 100px; } diff --git a/internal/compiler/tests/syntax/imports/deprecated_import.slint b/internal/compiler/tests/syntax/imports/deprecated_import.slint index 0b4e4d86cc7..986116ba06d 100644 --- a/internal/compiler/tests/syntax/imports/deprecated_import.slint +++ b/internal/compiler/tests/syntax/imports/deprecated_import.slint @@ -5,7 +5,7 @@ import { LineEdit } from "sixtyfps_widgets.60"; // ^warning{"sixtyfps_widgets\.60" was renamed "std-widgets\.slint". Use of the old file name is deprecated} -Blah := Window { +export Blah := Window { LineEdit {} // Not an error Button {} // Not imported // ^error{Unknown type Button} diff --git a/internal/compiler/tests/syntax/imports/error_in_import.slint b/internal/compiler/tests/syntax/imports/error_in_import.slint index 27293ccfad7..1c6b0962351 100644 --- a/internal/compiler/tests/syntax/imports/error_in_import.slint +++ b/internal/compiler/tests/syntax/imports/error_in_import.slint @@ -3,7 +3,7 @@ import { X } from "../../typeloader/incpath/should_fail2.slint"; -Foo := Rectangle { +export Foo := Rectangle { x:= X { hello: 42; meh: 12; diff --git a/internal/compiler/tests/syntax/imports/error_in_import2.slint b/internal/compiler/tests/syntax/imports/error_in_import2.slint index a0bc2008aa4..b252bfba9b5 100644 --- a/internal/compiler/tests/syntax/imports/error_in_import2.slint +++ b/internal/compiler/tests/syntax/imports/error_in_import2.slint @@ -3,6 +3,6 @@ import { Y } from "../../typeloader/incpath/should_fail3.slint"; -Foo := Rectangle { +export Foo := Rectangle { } diff --git a/internal/compiler/tests/syntax/imports/error_in_import3.slint b/internal/compiler/tests/syntax/imports/error_in_import3.slint index be35e488cfb..866de002f1e 100644 --- a/internal/compiler/tests/syntax/imports/error_in_import3.slint +++ b/internal/compiler/tests/syntax/imports/error_in_import3.slint @@ -3,7 +3,7 @@ import { Z } from "../../typeloader/incpath/should_fail4.slint"; -Foo := Rectangle { +export Foo := Rectangle { Z { property b: b1; } diff --git a/internal/compiler/tests/syntax/imports/import_error2.slint b/internal/compiler/tests/syntax/imports/import_error2.slint index 12590c73495..d8cdd932dcb 100644 --- a/internal/compiler/tests/syntax/imports/import_error2.slint +++ b/internal/compiler/tests/syntax/imports/import_error2.slint @@ -5,6 +5,6 @@ import { SomeRect } from "../../typeloader/incpath/local_helper_type.slint"; import "../../typeloader/incpath/local_helper_type.slint"; // ^error{Import names are missing. Please specify which types you would like to import} -X := Rectangle { +export X := Rectangle { } diff --git a/internal/compiler/tests/syntax/imports/import_errors.slint b/internal/compiler/tests/syntax/imports/import_errors.slint index adf50d5a8f6..72e75a904da 100644 --- a/internal/compiler/tests/syntax/imports/import_errors.slint +++ b/internal/compiler/tests/syntax/imports/import_errors.slint @@ -19,6 +19,6 @@ import "myimage.png"; import "."; // ^error{Unsupported foreign import ".*"} -X := Rectangle { +export X := Rectangle { } diff --git a/internal/compiler/tests/syntax/imports/import_parse_error5.slint b/internal/compiler/tests/syntax/imports/import_parse_error5.slint index 0a7f5494409..a085c7b5c40 100644 --- a/internal/compiler/tests/syntax/imports/import_parse_error5.slint +++ b/internal/compiler/tests/syntax/imports/import_parse_error5.slint @@ -5,6 +5,6 @@ import { NotExported } from "../../typeloader/incpath/local_helper_type.slint"; import { } from "../../typeloader/incpath/local_helper_type.slint"; // ^error{Import names are missing. Please specify which types you would like to import} -X := Rectangle { +export X := Rectangle { } diff --git a/internal/compiler/tests/syntax/imports/invalid_export.slint b/internal/compiler/tests/syntax/imports/invalid_export.slint index 3ae1a4540e9..849bb67eeaa 100644 --- a/internal/compiler/tests/syntax/imports/invalid_export.slint +++ b/internal/compiler/tests/syntax/imports/invalid_export.slint @@ -10,6 +10,6 @@ export { Image as Plop } export { string as Boob } // ^error{Cannot export 'string' because it is not a component} -Hello := Plop { -// ^error{Unknown type Plop} +export Hello := Plop { +// ^error{Unknown type Plop} } diff --git a/internal/compiler/tests/syntax/imports/visibility_errors.slint b/internal/compiler/tests/syntax/imports/visibility_errors.slint index 01ac28bead7..c1b5a0cd290 100644 --- a/internal/compiler/tests/syntax/imports/visibility_errors.slint +++ b/internal/compiler/tests/syntax/imports/visibility_errors.slint @@ -5,7 +5,7 @@ import { SomeRect } from "../../typeloader/incpath/local_helper_type.slint"; import { X } from "../../typeloader/incpath/should_fail.slint"; -Blah := X { +export Blah := X { width: 100px; // ^error{Unknown property width in X} } diff --git a/internal/compiler/tests/syntax/layout/if_in_grid.slint b/internal/compiler/tests/syntax/layout/if_in_grid.slint index bad2ef5fd80..775bfd08cb0 100644 --- a/internal/compiler/tests/syntax/layout/if_in_grid.slint +++ b/internal/compiler/tests/syntax/layout/if_in_grid.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Test := Rectangle { +export Test := Rectangle { property condition; GridLayout { diff --git a/internal/compiler/tests/syntax/layout/min_max_conflict.slint b/internal/compiler/tests/syntax/layout/min_max_conflict.slint index a20ca52f862..e44b88d3e89 100644 --- a/internal/compiler/tests/syntax/layout/min_max_conflict.slint +++ b/internal/compiler/tests/syntax/layout/min_max_conflict.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Test := Rectangle { +export Test := Rectangle { GridLayout { Rectangle { diff --git a/internal/compiler/tests/syntax/lookup/array_index.slint b/internal/compiler/tests/syntax/lookup/array_index.slint index 155d1d3a828..6a7615234fb 100644 --- a/internal/compiler/tests/syntax/lookup/array_index.slint +++ b/internal/compiler/tests/syntax/lookup/array_index.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Hello := Rectangle { +export Hello := Rectangle { property aa: 45; property <{o:[int], c:string}> bb; diff --git a/internal/compiler/tests/syntax/lookup/callback_alias.slint b/internal/compiler/tests/syntax/lookup/callback_alias.slint index 041f245d56b..383db8eb926 100644 --- a/internal/compiler/tests/syntax/lookup/callback_alias.slint +++ b/internal/compiler/tests/syntax/lookup/callback_alias.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Xxx := Rectangle { +export Xxx := Rectangle { foo := Rectangle { callback hello(int) -> int; diff --git a/internal/compiler/tests/syntax/lookup/callback_alias2.slint b/internal/compiler/tests/syntax/lookup/callback_alias2.slint index 4fe63531954..86ea7756677 100644 --- a/internal/compiler/tests/syntax/lookup/callback_alias2.slint +++ b/internal/compiler/tests/syntax/lookup/callback_alias2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Xxx := Rectangle { +export Xxx := Rectangle { foo := Rectangle { callback hello(int) -> int; diff --git a/internal/compiler/tests/syntax/lookup/callback_alias3.slint b/internal/compiler/tests/syntax/lookup/callback_alias3.slint index 8b004c119a1..8cf68f7afe1 100644 --- a/internal/compiler/tests/syntax/lookup/callback_alias3.slint +++ b/internal/compiler/tests/syntax/lookup/callback_alias3.slint @@ -6,7 +6,7 @@ Sub := Rectangle { callback compute_alias <=> compute; } -Xxx := Rectangle { +export Xxx := Rectangle { foo := Rectangle { callback hello(int) -> int; diff --git a/internal/compiler/tests/syntax/lookup/callback_return.slint b/internal/compiler/tests/syntax/lookup/callback_return.slint index 53cb044bd69..99c9c9c4cb7 100644 --- a/internal/compiler/tests/syntax/lookup/callback_return.slint +++ b/internal/compiler/tests/syntax/lookup/callback_return.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Xxx := Rectangle { +export Xxx := Rectangle { callback plop() -> string; plop => {} // ^error{Cannot convert void to string} diff --git a/internal/compiler/tests/syntax/lookup/color.slint b/internal/compiler/tests/syntax/lookup/color.slint index 769d2974bd9..6949f3dde8e 100644 --- a/internal/compiler/tests/syntax/lookup/color.slint +++ b/internal/compiler/tests/syntax/lookup/color.slint @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { Rectangle { background: blue; } diff --git a/internal/compiler/tests/syntax/lookup/conversion.slint b/internal/compiler/tests/syntax/lookup/conversion.slint index 9392419a072..81ad2a6f6ca 100644 --- a/internal/compiler/tests/syntax/lookup/conversion.slint +++ b/internal/compiler/tests/syntax/lookup/conversion.slint @@ -15,7 +15,7 @@ global Glob := { property rem_allowed: 42rem; } -X := Rectangle { +export X := Rectangle { t := Text { x: "hello"; diff --git a/internal/compiler/tests/syntax/lookup/dashes.slint b/internal/compiler/tests/syntax/lookup/dashes.slint index 1ee5b5c8ee6..96dc2af5bd4 100644 --- a/internal/compiler/tests/syntax/lookup/dashes.slint +++ b/internal/compiler/tests/syntax/lookup/dashes.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Xxx := Rectangle { +export Xxx := Rectangle { my-rect := Rectangle { border-width: 44px; diff --git a/internal/compiler/tests/syntax/lookup/deprecated_property.slint b/internal/compiler/tests/syntax/lookup/deprecated_property.slint index 229638e9c69..9c7bbae7a5e 100644 --- a/internal/compiler/tests/syntax/lookup/deprecated_property.slint +++ b/internal/compiler/tests/syntax/lookup/deprecated_property.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Xxx := Rectangle { +export Xxx := Rectangle { color: white; // ^warning{The property 'color' has been deprecated. Please use 'background' instead} diff --git a/internal/compiler/tests/syntax/lookup/enum.slint b/internal/compiler/tests/syntax/lookup/enum.slint index 6b6d5d2d03f..3adecd9cc77 100644 --- a/internal/compiler/tests/syntax/lookup/enum.slint +++ b/internal/compiler/tests/syntax/lookup/enum.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Text { +export TestCase := Text { // allow unqualified enum when we can infer the type from the property assigned to horizontal-alignment: right; diff --git a/internal/compiler/tests/syntax/lookup/for_lookup.slint b/internal/compiler/tests/syntax/lookup/for_lookup.slint index 76475fb9596..f851a2fb667 100644 --- a/internal/compiler/tests/syntax/lookup/for_lookup.slint +++ b/internal/compiler/tests/syntax/lookup/for_lookup.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Hello := Rectangle { +export Hello := Rectangle { aaa := Text{ text: "aaa"; bbb := Text{ text: "bbb"; } diff --git a/internal/compiler/tests/syntax/lookup/global.slint b/internal/compiler/tests/syntax/lookup/global.slint index e41368b6c9c..4ee1fbae890 100644 --- a/internal/compiler/tests/syntax/lookup/global.slint +++ b/internal/compiler/tests/syntax/lookup/global.slint @@ -16,7 +16,7 @@ global my_lowercase := { } -X := Rectangle { +export X := Rectangle { x: MyGlobal.custom_prop; background: MyGlobal.blue; // ^error{'MyGlobal' does not have a property 'blue'} diff --git a/internal/compiler/tests/syntax/lookup/if.slint b/internal/compiler/tests/syntax/lookup/if.slint index a42bb02ba6b..c1b253cf6a2 100644 --- a/internal/compiler/tests/syntax/lookup/if.slint +++ b/internal/compiler/tests/syntax/lookup/if.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Hello := Rectangle { +export Hello := Rectangle { width: 100phx; height: 100phx; diff --git a/internal/compiler/tests/syntax/lookup/property.slint b/internal/compiler/tests/syntax/lookup/property.slint index 55d57127b09..f7d84577612 100644 --- a/internal/compiler/tests/syntax/lookup/property.slint +++ b/internal/compiler/tests/syntax/lookup/property.slint @@ -15,7 +15,7 @@ Comp := Rectangle { } -X := Rectangle { +export X := Rectangle { width: 50phx; height: width; diff --git a/internal/compiler/tests/syntax/lookup/signal_arg.slint b/internal/compiler/tests/syntax/lookup/signal_arg.slint index 0848fe8727e..777d0ec9d1d 100644 --- a/internal/compiler/tests/syntax/lookup/signal_arg.slint +++ b/internal/compiler/tests/syntax/lookup/signal_arg.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Xxx := Rectangle { +export Xxx := Rectangle { callback plop(string, color, int); callback plop2(string, color, int); property glop_col; diff --git a/internal/compiler/tests/syntax/lookup/two_way_binding.slint b/internal/compiler/tests/syntax/lookup/two_way_binding.slint index d997d0adbfd..aaf354dd7d3 100644 --- a/internal/compiler/tests/syntax/lookup/two_way_binding.slint +++ b/internal/compiler/tests/syntax/lookup/two_way_binding.slint @@ -8,7 +8,7 @@ global G := { // ^error{The property does not have the same type as the bound property} } -X := Rectangle { +export X := Rectangle { property my_color <=> self.background; x <=> y; diff --git a/internal/compiler/tests/syntax/lookup/two_way_binding_infer.slint b/internal/compiler/tests/syntax/lookup/two_way_binding_infer.slint index f234e6b7b3f..349bbe77811 100644 --- a/internal/compiler/tests/syntax/lookup/two_way_binding_infer.slint +++ b/internal/compiler/tests/syntax/lookup/two_way_binding_infer.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -X := Rectangle { +export X := Rectangle { property infer_loop <=> infer_loop2; // ^error{Could not infer type of property 'infer-loop'} diff --git a/internal/compiler/tests/syntax/new_syntax/input_output.slint b/internal/compiler/tests/syntax/new_syntax/input_output.slint index 83eda555be6..63ae8549e72 100644 --- a/internal/compiler/tests/syntax/new_syntax/input_output.slint +++ b/internal/compiler/tests/syntax/new_syntax/input_output.slint @@ -55,7 +55,7 @@ OldCompo := Rectangle { } } -component Foo inherits Rectangle { +export component Foo inherits Rectangle { c1 := OldCompo { inout2: 42; diff --git a/internal/compiler/tests/syntax/new_syntax/input_output2.slint b/internal/compiler/tests/syntax/new_syntax/input_output2.slint index fab4e61e04a..7fc0b3139df 100644 --- a/internal/compiler/tests/syntax/new_syntax/input_output2.slint +++ b/internal/compiler/tests/syntax/new_syntax/input_output2.slint @@ -69,7 +69,7 @@ component A inherits Compo { // ^error{Unknown unqualified identifier 'priv1'} } -component Foo inherits Rectangle { +export component Foo inherits Rectangle { in property <[int]> input_model; diff --git a/internal/compiler/tests/syntax/new_syntax/new_component.slint b/internal/compiler/tests/syntax/new_syntax/new_component.slint index c02bf403034..eb3a4541a55 100644 --- a/internal/compiler/tests/syntax/new_syntax/new_component.slint +++ b/internal/compiler/tests/syntax/new_syntax/new_component.slint @@ -22,8 +22,8 @@ component Bar { @children } -component Baz { +export component Baz { Bar { Foo {} } -} \ No newline at end of file +} diff --git a/internal/compiler/tests/syntax/new_syntax/new_lookup.slint b/internal/compiler/tests/syntax/new_syntax/new_lookup.slint index e5bf10586f1..59494396d5e 100644 --- a/internal/compiler/tests/syntax/new_syntax/new_lookup.slint +++ b/internal/compiler/tests/syntax/new_syntax/new_lookup.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -component Compo inherits Text { +export component Compo inherits Text { property background: text; // ^error{Unknown unqualified identifier 'text'. Did you mean 'self.text'?} diff --git a/internal/compiler/tests/syntax/new_syntax/two_way_input_output.slint b/internal/compiler/tests/syntax/new_syntax/two_way_input_output.slint index f9bbd42eb39..bda7db3727b 100644 --- a/internal/compiler/tests/syntax/new_syntax/two_way_input_output.slint +++ b/internal/compiler/tests/syntax/new_syntax/two_way_input_output.slint @@ -293,7 +293,7 @@ component C11 { } } -Legacy1 := Rectangle { +export Legacy1 := Rectangle { b1:= Button {} in property in1 <=> b1.pressed; // ^warning{Link to a output property is deprecated} diff --git a/internal/compiler/tests/syntax/parse_error/children_placeholder0.slint b/internal/compiler/tests/syntax/parse_error/children_placeholder0.slint index d6312a42798..f22dc836b72 100644 --- a/internal/compiler/tests/syntax/parse_error/children_placeholder0.slint +++ b/internal/compiler/tests/syntax/parse_error/children_placeholder0.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -Final := Window { +export Final := Window { VerticalLayout { @ } diff --git a/internal/compiler/tests/syntax/parse_error/if0.slint b/internal/compiler/tests/syntax/parse_error/if0.slint index 7f42ed31b76..b8c57f22d0c 100644 --- a/internal/compiler/tests/syntax/parse_error/if0.slint +++ b/internal/compiler/tests/syntax/parse_error/if0.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { if // Foo { } // ^error{expected ':'} diff --git a/internal/compiler/tests/syntax/parse_error/if1.slint b/internal/compiler/tests/syntax/parse_error/if1.slint index 201d6b2b378..095e85e0384 100644 --- a/internal/compiler/tests/syntax/parse_error/if1.slint +++ b/internal/compiler/tests/syntax/parse_error/if1.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { if ( } diff --git a/internal/compiler/tests/syntax/parse_error/if2.slint b/internal/compiler/tests/syntax/parse_error/if2.slint index bdf97366b5b..abaa489d98f 100644 --- a/internal/compiler/tests/syntax/parse_error/if2.slint +++ b/internal/compiler/tests/syntax/parse_error/if2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { if () : // ^error{invalid expression} diff --git a/internal/compiler/tests/syntax/parse_error/if3.slint b/internal/compiler/tests/syntax/parse_error/if3.slint index 1dd8f372093..d6576308c3f 100644 --- a/internal/compiler/tests/syntax/parse_error/if3.slint +++ b/internal/compiler/tests/syntax/parse_error/if3.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { if goo } diff --git a/internal/compiler/tests/syntax/parse_error/if4.slint b/internal/compiler/tests/syntax/parse_error/if4.slint index 2dfe5ee9d5d..271e8fb29e5 100644 --- a/internal/compiler/tests/syntax/parse_error/if4.slint +++ b/internal/compiler/tests/syntax/parse_error/if4.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { if (true false) : Rectangle { } // ^error{Syntax error: expected '\)'} // ^^error{expected ':'} diff --git a/internal/compiler/tests/syntax/parse_error/property1.slint b/internal/compiler/tests/syntax/parse_error/property1.slint index 079963427fc..c2ab8332b22 100644 --- a/internal/compiler/tests/syntax/parse_error/property1.slint +++ b/internal/compiler/tests/syntax/parse_error/property1.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { ta := TouchArea { } Rectangle { diff --git a/internal/compiler/tests/syntax/parse_error/property2.slint b/internal/compiler/tests/syntax/parse_error/property2.slint index e64e37d2520..f74b7429fe5 100644 --- a/internal/compiler/tests/syntax/parse_error/property2.slint +++ b/internal/compiler/tests/syntax/parse_error/property2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Window { +export TestCase := Window { ta := TouchArea { } Rectangle { diff --git a/internal/compiler/tests/syntax/parse_error/state1.slint b/internal/compiler/tests/syntax/parse_error/state1.slint index f10aa49d79b..3e62b3643e1 100644 --- a/internal/compiler/tests/syntax/parse_error/state1.slint +++ b/internal/compiler/tests/syntax/parse_error/state1.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { property checked; property border; states [ diff --git a/internal/compiler/tests/syntax/parse_error/state2.slint b/internal/compiler/tests/syntax/parse_error/state2.slint index a22f61ba085..df8a6342aa3 100644 --- a/internal/compiler/tests/syntax/parse_error/state2.slint +++ b/internal/compiler/tests/syntax/parse_error/state2.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { states [ } diff --git a/internal/compiler/tests/syntax/parse_error/state3.slint b/internal/compiler/tests/syntax/parse_error/state3.slint index 36e0627cbf3..c74fb1274a5 100644 --- a/internal/compiler/tests/syntax/parse_error/state3.slint +++ b/internal/compiler/tests/syntax/parse_error/state3.slint @@ -1,7 +1,7 @@ // Copyright © SixtyFPS GmbH // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial -TestCase := Rectangle { +export TestCase := Rectangle { states [ checked when true: { foo diff --git a/internal/compiler/tests/syntax_tests.rs b/internal/compiler/tests/syntax_tests.rs index 63299832e62..59bc504942b 100644 --- a/internal/compiler/tests/syntax_tests.rs +++ b/internal/compiler/tests/syntax_tests.rs @@ -232,22 +232,22 @@ fn self_test() -> std::io::Result<()> { // this should succeed assert!(process( r#" -Foo := Rectangle { x: 0px; } +export Foo := Rectangle { x: 0px; } "# )?); // unless we expected an error assert!(!process( r#" -Foo := Rectangle { x: 0px; } -// ^error{i want an error} +export Foo := Rectangle { x: 0px; } +// ^error{i want an error} "# )?); // An error should fail assert!(!process( r#" -Foo := Rectangle foo { x:0px; } +export Foo := Rectangle foo { x:0px; } "# )?); diff --git a/internal/interpreter/api.rs b/internal/interpreter/api.rs index fd0f2a900c0..474f750eb2e 100644 --- a/internal/interpreter/api.rs +++ b/internal/interpreter/api.rs @@ -749,7 +749,7 @@ impl ComponentInstance { /// ``` /// use slint_interpreter::{ComponentDefinition, ComponentCompiler, Value, SharedString}; /// let code = r#" - /// MyWin := Window { + /// export MyWin := Window { /// property my_property: 42; /// } /// "#; diff --git a/internal/interpreter/lib.rs b/internal/interpreter/lib.rs index 502bc232214..fce8fda3a34 100644 --- a/internal/interpreter/lib.rs +++ b/internal/interpreter/lib.rs @@ -43,7 +43,7 @@ This example load a `.slint` from a string and set some properties: use slint_interpreter::{ComponentDefinition, ComponentCompiler, Value, SharedString, ComponentHandle}; let code = r#" - MyWin := Window { + export MyWin := Window { property my_name; Text { text: "Hello, " + my_name; diff --git a/internal/interpreter/tests.rs b/internal/interpreter/tests.rs index 4d3b67a2225..6176afa55a3 100644 --- a/internal/interpreter/tests.rs +++ b/internal/interpreter/tests.rs @@ -6,7 +6,7 @@ fn reuse_window() { i_slint_backend_testing::init(); use crate::{ComponentCompiler, ComponentHandle, SharedString, Value}; let code = r#" - MainWindow := Window { + export MainWindow := Window { property text_text: "foo"; property text_alias: input.text; input := TextInput { diff --git a/tools/lsp/server_loop.rs b/tools/lsp/server_loop.rs index db62a5420a3..266a8c31500 100644 --- a/tools/lsp/server_loop.rs +++ b/tools/lsp/server_loop.rs @@ -1470,8 +1470,10 @@ mod tests { #[test] fn test_reload_document_valid_contents() { - let (_, url, diag) = - loaded_document_cache("fluent", r#"component Main inherits Rectangle { }"#.into()); + let (_, url, diag) = loaded_document_cache( + "fluent", + r#"export component Main inherits Rectangle { }"#.into(), + ); assert!(diag.len() == 1); // Only one URL is known let diagnostics = diag.get(&url).expect("URL not found in result"); diff --git a/tools/online_editor/src/editor_widget.ts b/tools/online_editor/src/editor_widget.ts index 0013cfb2932..41d3b59fa34 100644 --- a/tools/online_editor/src/editor_widget.ts +++ b/tools/online_editor/src/editor_widget.ts @@ -33,7 +33,7 @@ import { commands } from "vscode"; import { StandaloneServices, ICodeEditorService } from "vscode/services"; const hello_world = `import { Button, VerticalBox } from "std-widgets.slint"; -component Demo { +export component Demo { VerticalBox { alignment: start; Text {