Bug 200006 - style checker should suggest that single-argument constructors be explicit
Summary: style checker should suggest that single-argument constructors be explicit
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-22 11:36 PDT by Simon Fraser (smfr)
Modified: 2019-07-22 12:35 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2019-07-22 11:36:57 PDT
Constructors that take a single argument should always be explicit; style checker should enforce this.
Comment 1 Darin Adler 2019-07-22 12:35:11 PDT
Many constructors that can take a single argument should be explicit. But some should not be.

This is something that requires thought so I’m not sure the style checker should check it, unless we have a guideline that says "ignore the style checker when you intentionally are creating a type conversion". There isn’t a "style suggestion checker", but for something like this there would need to be.

One alternative to consider would be to come up with some comment syntax meaning "I mean to use this constructor for type conversion". Then I think it would be fine for the style checker to warn when there's neither "explicit" nor the comment.