calculator: allow capital-only unit letters as variables
- Commit
79156c416a5b29859b7569bb8b387ea2249edddc- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-06 03:42 UTC (6 hours ago)
- Parents
f394f82
Owner correction to the reserved-letter prohibition: units that
use capital letters are allowed as variable names because
variables always use lowercase. The prohibited set was computed
case-insensitively from the parser/unit tables, so a/A, b/B, f/F,
j/J, n/N, v/V and w/W were all banned even though only the capital
spelling is a unit.
Derive Expression.prohibitedSingleLetterVariableNames
case-sensitively: e/x/t from the parser plus only the exact
lowercase single-letter tokens/aliases in
UnitRegistry.parseTokens (c Celsius alias, g gram, h hour,
k kelvin alias, l litre alias, m metre, s second). That gives
{c,e,g,h,k,l,m,s,t,x}, so assignableVariableNames is now
a b d f i j n o p q r u v w y z.
Enforce lowercase-only variables everywhere, which the old code
did not actually do: Expression.parse no longer lowercases
known variables, Parser matches named variables by exact raw
spelling, isVariableNameAvailable rejects any uppercase name,
CalculatorTab.insertVariable no longer folds uppercase to
lowercase, and assignmentTarget returns the name as written
(rejecting uppercase assignments). Re-evaluation still ignores
a stored single-letter assignment that cannot be a variable
now. Uppercase letters therefore keep their unit meaning even
when the lowercase variable is assigned: 2A is two amperes,
not 2*a. M has no single-letter token in the table, so 2M
fails as an unknown symbol rather than being eaten as 2*m.
Tests pin the exact prohibited/assignable sets against a
case-sensitive reading of the unit table, assert the
capital-only letters assign and read back, that the
lowercase-reserved letters are still rejected, and that
uppercase unit expressions are not eaten as variables.
calculator/AGENTS.md updated to the current letter set.
Verified: ./gradlew :calculator:lint
:calculator:lintVitalRelease :calculator:testDevUnitTest
(243 tests, all passing; lintVitalRelease SKIPPED as on base).
No devices used, no failures to prove pre-existing.Diff
calculator/AGENTS.md
diff --git a/calculator/AGENTS.md b/calculator/AGENTS.mdindex e5f6cbc58d..6ef6234dd1 100644--- a/calculator/AGENTS.md+++ b/calculator/AGENTS.md@@ -14,7 +14,7 @@ _Install: ./install calculator (dev by default)._ **Purpose:** Modern Material You calculator — scientific/basic modes, function graphing with analysis, and a multi-category unit converter with live currency rates. **Key features:** - Scientific + basic keypad with multi-line expression history: lines stack above the input, tapping a line reuses its result, long-pressing loads its expression for in-place editing (submitting re-runs that line and every line after it in order), and assigned variables show above the input and survive AC-- Variables instead of an M register: the `var` key opens a dropup listing every assignable single letter with current values; selecting one inserts just its name (variable names are entered only this way — the 2nd layer shifts function/operator keys only and digit keys always emit digits). Assignable letters are `a`–`z` except the prohibited set in `Expression.prohibitedSingleLetterVariableNames`, derived from the engine's reserved meanings: `e` (Euler), `x`/`t` (graph free variable) and every single-letter unit token/alias in `UnitRegistry.parseTokens` (`a`/`b`/`c`/`f`/`g`/`h`/`j`/`k`/`l`/`m`/`n`/`s`/`v`/`w`); today that leaves `d`/`i`/`o`/`p`/`q`/`r`/`u`/`y`/`z`. A prohibited letter keeps its original meaning everywhere and can never be assigned: it is absent from the dropup and a `<letter>=…` line is rejected like other invalid assignments; a pre-existing assignment to a now-prohibited letter is ignored (its line still evaluates, the variable is dropped) on the next re-evaluation. Picking a name, then the literal `=` key, a value and Enter assigns (`d=5`); a name alone plus Enter reads its value; any other line plus Enter evaluates as a plain expression. Only a leading `<name>=<expr>` line assigns on Enter, and reserved names (`e`, multi-letter `ans`/`pi`/`tau`/`phi`/`theta`, functions, multi-letter unit tokens) can never be assigned. The literal `=` key is a regular key in the top section and never submits; the accent Enter key (filled return icon, bottom-right) submits+- Variables instead of an M register: the `var` key opens a dropup listing every assignable single letter with current values; selecting one inserts just its name (variable names are entered only this way — the 2nd layer shifts function/operator keys only and digit keys always emit digits). Variable names are lowercase-only: an uppercase letter in an expression is always a unit symbol, never a variable. Assignable letters are `a`–`z` except the prohibited set in `Expression.prohibitedSingleLetterVariableNames`, derived case-sensitively from the engine's reserved meanings: `e` (Euler), `x`/`t` (graph free variable) and every single-letter unit token/alias in `UnitRegistry.parseTokens` whose exact spelling is lowercase (`c`/`g`/`h`/`k`/`l`/`m`/`s`); today that leaves `a`/`b`/`d`/`f`/`i`/`j`/`n`/`o`/`p`/`q`/`r`/`u`/`v`/`w`/`y`/`z` assignable, so a letter whose only reserved form is capital (`A` ampere, `B` byte, `F` farad, `J` joule, `N` newton, `V` volt, `W` watt) is assignable in lowercase while its capital keeps the unit meaning (`a` the variable vs `2A` two amperes). A prohibited letter keeps its original meaning everywhere and can never be assigned: it is absent from the dropup and a `<letter>=…` line is rejected like other invalid assignments (an uppercase `<Letter>=…` line is likewise never an assignment); a pre-existing assignment to a now-prohibited letter is ignored (its line still evaluates, the variable is dropped) on the next re-evaluation. Picking a name, then the literal `=` key, a value and Enter assigns (`d=5`); a name alone plus Enter reads its value; any other line plus Enter evaluates as a plain expression. Only a leading `<name>=<expr>` line assigns on Enter, and reserved names (`e`, multi-letter `ans`/`pi`/`tau`/`phi`/`theta`, functions, multi-letter unit tokens) can never be assigned. The literal `=` key is a regular key in the top section and never submits; the accent Enter key (filled return icon, bottom-right) submits - Graph page: plots functions with root / intercept / min-max / intersection detection - Unit converter across many categories incl. live currency rates (`CurrencyApi` over `:library:network`) - Home-screen widgets for both calculator and unit converter (`:library:widgets` Glance)
calculator/src/main/java/com/vayunmathur/calculator/domain/Expression.kt
diff --git a/calculator/src/main/java/com/vayunmathur/calculator/domain/Expression.kt b/calculator/src/main/java/com/vayunmathur/calculator/domain/Expression.ktindex 7510924236..98ec144edc 100644--- a/calculator/src/main/java/com/vayunmathur/calculator/domain/Expression.kt+++ b/calculator/src/main/java/com/vayunmathur/calculator/domain/Expression.kt@@ -118,10 +118,12 @@ class Expression private constructor( /** Parses expression text into an [Expression]. */ companion object { /**- * Parses [input]. Identifiers in [knownVariables] (matched case-insensitively)- * become named-variable references resolved from the map passed at evaluation- * time; any other unknown identifier still fails, so graph expressions and- * other callers that pass no names keep their current error behaviour.+ * Parses [input]. Identifiers in [knownVariables] (matched case-sensitively:+ * variable names are lowercase-only, so an uppercase letter is never a+ * variable reference) become named-variable references resolved from the map+ * passed at evaluation time; any other unknown identifier still fails, so graph+ * expressions and other callers that pass no names keep their current error+ * behaviour. */ fun parse( input: String,@@ -130,7 +132,7 @@ class Expression private constructor( Expression( Parser( input,- knownVariables.map { it.lowercase() }.filter { isVariableNameAvailable(it) }.toSet(),+ knownVariables.filter { isVariableNameAvailable(it) }.toSet(), ).parse(), ) @@ -139,14 +141,17 @@ class Expression private constructor( * from the engine's own reserved meanings — not an invented list: * `e` (Euler's constant in [Parser.parseIdentifier]), `x`/`t` (the * free variable, also `theta`), plus every single-letter token or- * alias in [UnitRegistry.parseTokens] (the parser's unit table,- * matched case-insensitively because variable lookup lowercases- * names: `A`/`a` ampere, `B`/`b` byte, `C`/`c` coulomb and the- * Celsius alias, `F`/`f` farad, `g` gram, `h` hour, `J`/`j` joule,- * `K`/`k` kelvin, `L`/`l` litre, `m` metre, `N`/`n` newton, `s`- * second, `V`/`v` volt, `W`/`w` watt). A prohibited letter keeps- * its original meaning everywhere; it is never shadowed by a- * variable, in the calculator tab or anywhere else.+ * alias in [UnitRegistry.parseTokens] whose exact spelling is+ * lowercase (the parser's unit table is case-sensitive and variable+ * names are lowercase-only, so only a lowercase unit spelling can+ * collide with a variable: `c` Celsius alias, `g` gram, `h` hour,+ * `k` kelvin alias, `l` litre alias, `m` metre, `s` second). A+ * letter whose only reserved spelling is capital (`A` ampere, `B`+ * byte, `F` farad, `J` joule, `N` newton, `V` volt, `W` watt) stays+ * assignable in lowercase because `a` and `A` are different symbols:+ * the lowercase letter is a variable, the capital is the unit. A+ * prohibited letter keeps its original meaning everywhere; it is+ * never shadowed by a variable, in the calculator tab or anywhere else. */ val prohibitedSingleLetterVariableNames: Set<String> = buildSet {@@ -154,7 +159,7 @@ class Expression private constructor( add("t") add("x") for (key in UnitRegistry.parseTokens.keys) {- if (key.length == 1) add(key.lowercase())+ if (key.length == 1 && key[0] in 'a'..'z') add(key) } } @@ -168,20 +173,24 @@ class Expression private constructor( /** * Whether [name] may be assigned as a calculator variable: a plain- * identifier that is not reserved — a prohibited single letter- * (see [prohibitedSingleLetterVariableNames]), the multi-letter+ * lowercase identifier that is not reserved — a prohibited single+ * letter (see [prohibitedSingleLetterVariableNames]), the multi-letter * constants (`pi`/`tau`/`phi`/`theta`), `ans`, a function name, or- * a multi-letter unit token. Any other single letter is allowed.+ * a multi-letter unit token. Variable names are lowercase-only: any+ * uppercase letter makes [name] unavailable, because an uppercase+ * letter in an expression is a unit symbol (or constant/function+ * spelling), never a variable. Any other lowercase single letter+ * is allowed. */ fun isVariableNameAvailable(name: String): Boolean { if (name.isEmpty() || !name.first().isLetter() && name.first() != '_') return false if (!name.all { it.isLetterOrDigit() || it == '_' }) return false- val lower = name.lowercase()- if (lower in prohibitedSingleLetterVariableNames) return false- if (lower in setOf("theta", "ans", "pi", "tau", "phi")) return false- if (lower in TRIG_FUNCTIONS || lower in HYPERBOLIC_FUNCTIONS) return false- if (lower in SINGLE_ARG_FUNCTIONS || lower in PAIR_FUNCTIONS) return false- if (lower in setOf("abs", "log", "max", "min")) return false+ if (name != name.lowercase()) return false+ if (name in prohibitedSingleLetterVariableNames) return false+ if (name in setOf("theta", "ans", "pi", "tau", "phi")) return false+ if (name in TRIG_FUNCTIONS || name in HYPERBOLIC_FUNCTIONS) return false+ if (name in SINGLE_ARG_FUNCTIONS || name in PAIR_FUNCTIONS) return false+ if (name in setOf("abs", "log", "max", "min")) return false if (name.length == 1) return true return name !in UnitRegistry.parseTokens }@@ -607,13 +616,18 @@ class Expression private constructor( val raw = src.substring(start, pos) val name = raw.lowercase() // A known (assignable) variable wins over other single-word- // meanings in variable position. Only the calculator tab ever- // passes known variables, and only names it has actually- // assigned; [parse] filters prohibited single letters out of- // the known set, so `e`/`x`/`t` and unit spellings such as- // `g`/`m` always keep their original meaning, and- // graph/widget/intent parses (no known variables) are unchanged.- if (name in knownVariables && peek() != '(') return NamedVar(name)+ // meanings in variable position, matched case-sensitively:+ // variable names are lowercase-only, so only an exactly+ // lowercase spelling can be a variable reference and an+ // uppercase letter always keeps its unit/constant meaning+ // (`a` the variable vs `A` ampere, even when `a` is assigned).+ // Only the calculator tab ever passes known variables, and+ // only names it has actually assigned; [parse] filters+ // prohibited single letters out of the known set, so `e`/`x`/`t`+ // and lowercase unit spellings such as `g`/`m` always keep their+ // original meaning, and graph/widget/intent parses (no known+ // variables) are unchanged.+ if (raw in knownVariables && peek() != '(') return NamedVar(raw) return when (name) { "x", "t", "theta" -> Var "ans" -> Ans@@ -621,7 +635,7 @@ class Expression private constructor( "tau" -> Num(TAU_FACTOR * PI) "e" -> Num(E) "phi" -> Num((1 + sqrt(PHI_RADICAND)) / 2)- else -> if (name in knownVariables && peek() != '(') NamedVar(name) else parseFunctionOrUnit(raw, name)+ else -> if (raw in knownVariables && peek() != '(') NamedVar(raw) else parseFunctionOrUnit(raw, name) } }
calculator/src/main/java/com/vayunmathur/calculator/platform/CalculatorTab.kt
diff --git a/calculator/src/main/java/com/vayunmathur/calculator/platform/CalculatorTab.kt b/calculator/src/main/java/com/vayunmathur/calculator/platform/CalculatorTab.ktindex a97501408a..70089cf352 100644--- a/calculator/src/main/java/com/vayunmathur/calculator/platform/CalculatorTab.kt+++ b/calculator/src/main/java/com/vayunmathur/calculator/platform/CalculatorTab.kt@@ -202,9 +202,11 @@ class CalculatorTab { * Enter ([evaluate]); this method never assigns. */ fun insertVariable(name: String) {- val lower = name.lowercase()- if (lower !in Expression.assignableVariableNames) return- append(lower)+ // Variable names are lowercase-only: only an exact assignable+ // lowercase letter is inserted, never an uppercase spelling folded+ // to lowercase (an uppercase letter is a unit symbol).+ if (name !in Expression.assignableVariableNames) return+ append(name) } /** Re-derive [preview], [unitOptions] and [selectedUnit] from the current [input]. */@@ -215,7 +217,7 @@ class CalculatorTab { val match = ASSIGNMENT_REGEX.matchEntire(text.trim()) ?: return null val name = match.groupValues[1] if (!Expression.isVariableNameAvailable(name)) throw ExpressionError("Cannot assign to '$name'")- return name.lowercase()+ return name } /** Evaluate one history line, returning its value and the variable it assigns to, if any. */@@ -228,7 +230,11 @@ class CalculatorTab { val match = ASSIGNMENT_REGEX.matchEntire(text.trim()) if (match != null && ignoreProhibitedAssignment) { val name = match.groupValues[1]- if (name.lowercase() in Expression.prohibitedSingleLetterVariableNames) {+ // A single-letter assignment that cannot be a variable now+ // (a lowercase-prohibited letter, or any uppercase spelling)+ // is ignored on re-evaluation; multi-letter unavailable names+ // keep the honest rejection.+ if (name.length == 1 && !Expression.isVariableNameAvailable(name)) { val quantity = Expression .parse(match.groupValues[2], vars.keys)
calculator/src/test/java/com/vayunmathur/calculator/util/MultiLineVariablesTest.kt
diff --git a/calculator/src/test/java/com/vayunmathur/calculator/util/MultiLineVariablesTest.kt b/calculator/src/test/java/com/vayunmathur/calculator/util/MultiLineVariablesTest.ktindex b99920148e..454e550868 100644--- a/calculator/src/test/java/com/vayunmathur/calculator/util/MultiLineVariablesTest.kt+++ b/calculator/src/test/java/com/vayunmathur/calculator/util/MultiLineVariablesTest.kt@@ -105,7 +105,7 @@ class MultiLineVariablesTest { @Test fun dropupSelectionRejectsReservedAndNonAssignableNames() {- for (name in listOf("e", "m", "g", "x", "a", "b", "pi", "ans", "sin", "log", "radius", "")) {+ for (name in listOf("e", "m", "g", "x", "c", "k", "l", "s", "A", "D", "pi", "ans", "sin", "log", "radius", "")) { val tab = CalculatorTab() tab.insertVariable(name) assertEquals("", tab.input, name)@@ -238,7 +238,7 @@ class MultiLineVariablesTest { @Test fun reservedOrUnknownNamesDoNotEvaluate() {- for (src in listOf("e=5", "m=5", "g=5", "x=5", "a=5", "pi=3", "sin=1", "ans=1", "d+1")) {+ for (src in listOf("e=5", "m=5", "g=5", "x=5", "c=5", "k=5", "l=5", "s=5", "t=5", "h=5", "A=5", "D=5", "pi=3", "sin=1", "ans=1", "d+1")) { val tab = CalculatorTab() tab.updateInput(src) tab.evaluate()@@ -269,4 +269,47 @@ class MultiLineVariablesTest { tab.updateInput("d+1") assertEquals("6", tab.preview) }++ @Test+ fun capitalOnlyLettersAssignAndReadBack() {+ for (name in listOf("a", "b", "f", "j", "n", "v", "w")) {+ val tab = CalculatorTab()+ tab.updateInput("$name=5")+ tab.evaluate()+ assertEquals("5", tab.uiState.variables[name], name)+ tab.updateInput("$name*2")+ tab.evaluate()+ assertEquals(10.0, tab.lastAnswer, 0.0, name)+ }+ }++ @Test+ fun lowercaseReservedLettersStillCannotBeAssigned() {+ for (name in listOf("c", "e", "g", "h", "k", "l", "m", "s", "t", "x")) {+ val tab = CalculatorTab()+ tab.updateInput("$name=5")+ tab.evaluate()+ assertTrue(tab.history.isEmpty(), name)+ assertEquals("$name=5", tab.input, name)+ assertTrue(tab.uiState.variables.isEmpty(), name)+ }+ }++ @Test+ fun uppercaseUnitExpressionsAreNotEatenAsVariables() {+ val tab = CalculatorTab()+ tab.updateInput("a=5")+ tab.evaluate()+ assertEquals("5", tab.uiState.variables["a"])+ // `2A` is two amperes (base value 2), not 2*a = 10.+ tab.updateInput("2A")+ tab.evaluate()+ assertEquals(2.0, tab.lastAnswer, 0.0)+ // `2M` has no single-letter token: it is not eaten as 2*m either.+ val fresh = CalculatorTab()+ fresh.updateInput("2M")+ fresh.evaluate()+ assertTrue(fresh.history.isEmpty())+ assertEquals("2M", fresh.input)+ } }
calculator/src/test/java/com/vayunmathur/calculator/util/VariableExpressionTest.kt
diff --git a/calculator/src/test/java/com/vayunmathur/calculator/util/VariableExpressionTest.kt b/calculator/src/test/java/com/vayunmathur/calculator/util/VariableExpressionTest.ktindex 0ba0774cbc..05b778cbc9 100644--- a/calculator/src/test/java/com/vayunmathur/calculator/util/VariableExpressionTest.kt+++ b/calculator/src/test/java/com/vayunmathur/calculator/util/VariableExpressionTest.kt@@ -36,8 +36,15 @@ class VariableExpressionTest { } @Test- fun variableNamesAreCaseInsensitive() {- val expr = Expression.parse("D+1", knownVariables = setOf("d"))+ fun variableNamesAreLowercaseOnly() {+ // Uppercase letters are unit symbols, never variables: `D` is not+ // the variable `d`, even when `d` is assigned.+ assertFailsWith<ExpressionError> { Expression.parse("D+1", knownVariables = setOf("d")) }+ assertFalse(Expression.isVariableNameAvailable("D"))+ assertFalse(Expression.isVariableNameAvailable("A"))+ assertFalse(Expression.isVariableNameAvailable("Radius"))+ // An exactly lowercase spelling still resolves.+ val expr = Expression.parse("d+1", knownVariables = setOf("d")) assertEquals(4.0, expr.eval(variables = mapOf("d" to Quantity.scalar(3.0)))) } @@ -54,31 +61,79 @@ class VariableExpressionTest { @Test fun prohibitedSingleLettersMatchTheEnginesReservedSymbols() {- // Derived from the engine itself: `e` (Euler), `x`/`t` (free- // variable) in the parser, plus every single-letter token/alias in- // UnitRegistry.parseTokens — a/A ampere, b/B byte, c/C coulomb and- // Celsius alias, f/F farad, g gram, h hour, j/J joule, k/K kelvin,- // l/L litre, m metre, n/N newton, s second, v/V volt, w/W watt.- val expected =- setOf("a", "b", "c", "e", "f", "g", "h", "j", "k", "l", "m", "n", "s", "t", "v", "w", "x")+ // Case-sensitive reading of the engine itself: `e` (Euler), `x`/`t`+ // (free variable) in the parser, plus every single-letter token/alias+ // in UnitRegistry.parseTokens whose exact spelling is lowercase —+ // c (Celsius alias), g (gram), h (hour), k (kelvin alias), l (litre+ // alias), m (metre), s (second). Pin the exact set so a table change+ // is a deliberate test change.+ val expected = setOf("c", "e", "g", "h", "k", "l", "m", "s", "t", "x") assertEquals(expected, Expression.prohibitedSingleLetterVariableNames)+ // The pinned set matches a case-sensitive derivation from the table.+ val derived =+ buildSet {+ add("e")+ add("t")+ add("x")+ for (key in com.vayunmathur.calculator.domain.UnitRegistry.parseTokens.keys) {+ if (key.length == 1 && key[0] in 'a'..'z') add(key)+ }+ }+ assertEquals(expected, derived) for (name in expected) { assertFalse(Expression.isVariableNameAvailable(name), name) assertFalse(name in Expression.assignableVariableNames, name) }- // Case-insensitive: an uppercase spelling of a unit is prohibited too.- for (name in listOf("A", "B", "C", "F", "J", "K", "L", "M", "N", "V", "W", "X", "E")) {- assertFalse(Expression.isVariableNameAvailable(name), name)+ // Per-letter table over a-z: assignable is exactly a-z minus the+ // prohibited set, and every uppercase spelling is unavailable as a+ // variable (uppercase is a unit symbol, never a variable).+ for (letter in 'a'..'z') {+ val lower = letter.toString()+ assertEquals(lower !in expected, Expression.isVariableNameAvailable(lower), lower)+ assertEquals(lower !in expected, lower in Expression.assignableVariableNames, lower)+ assertFalse(Expression.isVariableNameAvailable(letter.uppercaseChar().toString()), lower)+ }+ }++ @Test+ fun capitalOnlyUnitLettersAreAssignableInLowercase() {+ // Only capital reserved form: A ampere, B byte, F farad, J joule,+ // N newton, V volt, W watt. Their lowercase letters assign + read back.+ for (name in listOf("a", "b", "f", "j", "n", "v", "w")) {+ assertTrue(Expression.isVariableNameAvailable(name), name)+ val expr = Expression.parse("$name*2", knownVariables = setOf(name))+ assertEquals(10.0, expr.eval(variables = mapOf(name to Quantity.scalar(5.0))), name) } } + @Test+ fun uppercaseSpellingsStillParseAsUnitsNotVariables() {+ // Even with the lowercase variable assigned, a capital letter is+ // its unit: `2A` is two amperes, not 2*a.+ fun base(src: String, name: String) =+ Expression.parse(src, knownVariables = setOf(name))+ .evalQuantity(variables = mapOf(name to Quantity.scalar(5.0))).baseValue+ assertEquals(2.0, base("2A", "a"), 1e-12)+ assertEquals(2.0, base("2V", "v"), 1e-12)+ assertEquals(2.0, base("2W", "w"), 1e-12)+ assertEquals(2.0, base("2J", "j"), 1e-12)+ assertEquals(2.0, base("2F", "f"), 1e-12)+ assertEquals(2.0, base("2N", "n"), 1e-12)+ // Byte is 8 bits: `2B` is 16 in base units, not 2*b.+ assertEquals(16.0, base("2B", "b"), 1e-12)+ // `M` has no single-letter token in the table, so `2M` is neither+ // the variable `m` nor a unit: it fails instead of being eaten as+ // 2*m (metre) or as a variable.+ assertFailsWith<ExpressionError> { Expression.parse("2M", knownVariables = setOf("m", "a")) }+ }+ @Test fun allowedSingleLettersCanBeVariables() {- for (name in listOf("d", "i", "o", "p", "q", "r", "u", "y", "z")) {+ for (name in listOf("a", "b", "d", "f", "i", "j", "n", "o", "p", "q", "r", "u", "v", "w", "y", "z")) { assertTrue(Expression.isVariableNameAvailable(name), name) } assertEquals(- listOf("d", "i", "o", "p", "q", "r", "u", "y", "z"),+ listOf("a", "b", "d", "f", "i", "j", "n", "o", "p", "q", "r", "u", "v", "w", "y", "z"), Expression.assignableVariableNames, ) assertTrue(Expression.assignableVariableNames.all { Expression.isVariableNameAvailable(it) })