Skip to content

Adding a new warning: -Wterm-variable-capture

Motivation

Proposal 0281 introduces a new RequiredTypeArguments extension. It affects the name resolution, including the case of implicit quantification. If the extension is enabled then using names already used at the term-level is forbidden.

Proposal

In order to facilitate writing code that is forward-compatible with RequiredTypeArguments, I would like to introduce a new warning to -Wcompat: -Wterm-variable-capture. This warning will notify users when implicit quantification occurs that would stop working under RequiredTypeArguments.

Update

Based on the discussion, it was decided to implement the warning but postpone adding it to -Wcompat.

Edited by Vladislav Zavialov
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information