Skip to content

Commit

Permalink
Change error message
Browse files Browse the repository at this point in the history
  • Loading branch information
sixolet committed Apr 1, 2017
1 parent 54ae7aa commit 0aa5a70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mypy/checkmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/check-typevar-values.test
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 0aa5a70

Please sign in to comment.