Skip to content

[zh-CN] reportUntypedFunctionDecorator message implies users should remove decorator #7983

Description

@MutableMappingSequence

Environment data

Untyped function/class decorator obscures type of function; ignoring decorator

  • Pylance version: v2026.2.1
  • OS and version: Windows 11 25H2 26200.8037
  • Python version: 3.14.3

Bug Description

The Chinese translation of reportUntypedFunctionDecorator contains a UX defect: the phrase "忽略装饰器" is easily misinterpreted as instructing the user to remove the decorator, rather than explaining the type checker's behavior.

Current vs. Expected Behavior

Aspect Current Expected
Message 未类型化的函数修饰器遮盖函数类型;忽略修饰器 装饰器返回类型未知,类型检查器已跳过该装饰器
User interpretation "Please ignore/delete this decorator" "Type checker skipped this decorator during analysis"
Risk Users may mistakenly remove working decorators Users understand runtime is unaffected

Root Cause

The English original uses "ignoring decorator" (present participle with implied subject "type checker"), but the Chinese translation "忽略装饰器" loses the subject and becomes an imperative/command tone.

Code Snippet

Any scenario triggering reportUntypedFunctionDecorator reproduces the ambiguity:

def untyped_decorator(f):
    return f

@untyped_decorator  # this may triggers the diagnostic
def example(): pass

@undefined_decorator  # undefined decorators may triggers the diagnostic, too.
def example(): pass

Note: It is possible that this snippet may not trigger the diagnostic. However, it doesn't matter because this issue focuses on the wording quality of the message when it appears, not on when it triggers.

Suggested Fix

Replace the semicolon-connected phrase with a clearer causative structure:
装饰器返回类型未知,类型检查器已跳过该装饰器
Or alternatively:
无法推断装饰器类型,已回退至原始函数类型

Related

  • Similar confusion in other decorator-related diagnostics (e.g., reportUntypedClassDecorator)

Metadata

Metadata

Assignees

Labels

ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.team needs to reproduceIssue has not been reproduced yet

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions