Skip to content

Add SyntaxError hint for incorrectly using C "//" or "/*...*/" to comment #134002

Closed as not planned
@Locked-chess-official

Description

@Locked-chess-official

Feature or enhancement

Proposal:

Sometimes another programmer may make the mistake that using "//" or "/**/" to comment, especially cross-language projects.

In my option, showing the message need to satisfy the following comditions:
If the Exception raised by "//":
1: must at the beginning of the line.
2: the last line of the code cannot be end with ""


#SyntaxError(need)
def one_or_two():
    // 1 or 2
    a = random.randrange(1,3)
    return a

#SyntaxError(don't need)
def one_or_two(): // 1 or 2
    a = random.randrange(1,3)
    return a

#TypeError(don't need)
def one_or_two():
    a = random.randrange(1,2)
    print(a) // 1 or 2

#Valid
def one_or_two():
    a = random.randrange(1,3)
    return a // 1 or 2

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions