{"record":{"id":"79c5e63503a235d0","repo":"slint-ui/slint","slug":"use-space-before-the-if-you-meant-a-subtraction","errorCode":null,"errorMessage":". Use space before the '-' if you meant a subtraction","messagePattern":"\\. Use space before the '-' if you meant a subtraction","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/compiler/passes/resolving.rs","lineNumber":2945,"sourceCode":"                }\n            };\n            ctx.diag.push_error(\n                format!(\"{} does not have a property '{}'{}\", what, second.text(), extra),\n                &second,\n            );\n        };\n        if let Some(minus_pos) = second.text().find('-') {\n            // Attempt to recover if the user wanted to write \"-\"\n            if elem\n                .borrow()\n                .lookup_property(\n                    &crate::parser::normalize_identifier(&second.text()[0..minus_pos]),\n                    mode,\n                )\n                .property_type\n                != Type::Invalid\n            {\n                err(\". Use space before the '-' if you meant a subtraction\");\n                return None;\n            }\n        }\n        err(\"\");\n        None\n    }\n}\n\nfn maybe_lookup_object(\n    mut base: LookupResult,\n    it: impl Iterator<Item = crate::parser::SyntaxToken>,\n    ctx: &mut LookupCtx,\n) -> Option<LookupResult> {\n    for next in it {\n        let next_str = crate::parser::normalize_identifier(next.text());\n        ctx.current_token = Some(next.clone().into());\n        match base.lookup(ctx, &next_str) {\n            Some(r) => {","sourceCodeStart":2927,"sourceCodeEnd":2963,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/compiler/passes/resolving.rs#L2927-L2963","documentation":"This is a Slint compiler diagnostic emitted by the name-resolution pass (continue_lookup_within_element, reached via lookup_qualified_name_node) when a hyphenated identifier lookup fails and the parser suspects the '-' was intended as subtraction. Slint identifiers may contain hyphens, so `a-b` is lexed as one identifier; if that identifier does not resolve but `a` is a valid element/property, the compiler suggests you may have meant subtraction. It is a hint accompanying a resolution error, not a panic.","triggerScenarios":"Writing an expression like `width - 10px` where `width` is not in scope, or `parent.property` minus a value, such that the whole `a-b` token fails qualified-name lookup while the prefix before '-' resolves and its property_type is valid.","commonSituations":"Migrating CSS-like habits into .slint expressions, doing arithmetic on a property name with no space around the minus, or typos in hyphenated identifiers where the prefix alone happens to be valid.","solutions":["Add spaces around the '-' operator: `width - 10px`","Check the spelling of the hyphenated identifier; if it is a real element/property name, ensure it is in scope","If subtraction was intended, parenthesize: `(a) - (b)`","Report upstream if the diagnostic appears despite correct spacing"],"exampleFix":"// before\nx: parent.width-20px;\n// after\nx: parent.width - 20px;","handlingStrategy":"validation","validationCode":"// Ensure spaces around '-' in .slint expressions:\n// x: parent.width - 20px;  (not parent.width-20px)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always put spaces around binary operators in .slint expressions","Remember hyphens are legal inside Slint identifiers","Run the compiler/LSP frequently to catch resolution errors early","Parenthesize compound subtractions"],"tags":["slint","compiler","diagnostic","identifier","subtraction"],"backgroundTag":"invalid-identifier-format","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}