From 0aa5a7051ec43ce61a8569fee14f18655a5efef0 Mon Sep 17 00:00:00 2001 From: Naomi Seyfer Date: Sat, 1 Apr 2017 11:30:27 -0700 Subject: [PATCH] Change error message --- mypy/checkmember.py | 2 +- test-data/unit/check-typevar-values.test | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy/checkmember.py b/mypy/checkmember.py index 83c4660cb1b1..6c934dccb022 100644 --- a/mypy/checkmember.py +++ b/mypy/checkmember.py @@ -406,7 +406,7 @@ def analyze_class_attribute_access(itype: Instance, return AnyType() if isinstance(node.node, TypeVarExpr): - msg.fail('Type variable "{}.{}" is invalid in a runtime context'.format( + msg.fail('Type variable "{}.{}" cannot be used as an expression'.format( itype.type.name(), name), context) return AnyType() diff --git a/test-data/unit/check-typevar-values.test b/test-data/unit/check-typevar-values.test index 29c72add0624..36df2235a209 100644 --- a/test-data/unit/check-typevar-values.test +++ b/test-data/unit/check-typevar-values.test @@ -505,8 +505,8 @@ class C: reveal_type(l) # E: Revealed type is 'builtins.list[T`-1]' y: C.T = x l.append(x) - C.T # E: Type variable "C.T" is invalid in a runtime context - A = C.T # E: Type variable "C.T" is invalid in a runtime context + C.T # E: Type variable "C.T" cannot be used as an expression + A = C.T # E: Type variable "C.T" cannot be used as an expression return l[0] [builtins fixtures/list.pyi]