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)
Environment data
Untyped function/class decorator obscures type of function; ignoring decorator
Bug Description
The Chinese translation of
reportUntypedFunctionDecoratorcontains 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
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
reportUntypedFunctionDecoratorreproduces the ambiguity:Suggested Fix
Replace the semicolon-connected phrase with a clearer causative structure:
装饰器返回类型未知,类型检查器已跳过该装饰器
Or alternatively:
无法推断装饰器类型,已回退至原始函数类型
Related
reportUntypedClassDecorator)