Skip to content

py3.15: error with sentinel + type qualifier (Final / ClassVar) #5560

Description

@randolf-scholz

Describe the Bug

I didn't expect any errors on this code:

from typing import Final, ClassVar

class Foo:
    MARKER = sentinel("MARKER")
    _value: int | MARKER  # ✅️

class Bar:
    MARKER: ClassVar = sentinel("MARKER")
    _value: int | MARKER  # ❌️

class Baz:
    MARKER: Final = sentinel("MARKER")
    _value: int | MARKER  # ❌️
ERROR sandbox.py:9:13-25: Expected a type form, got instance of `type[int] | UnionType` [not-a-type]
ERROR sandbox.py:13:13-25: Expected a type form, got instance of `type[int] | UnionType` [not-a-type]

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.I6HIhJaMsKISkaHc8vOh4eLrGOTtGgR0aHFqXklmXmqORowSRCxGCRgnICXx0FQNjCpgkoZqUFBWeDSn9f2OfoShTomwGICosYJbTJ7xc3vQjK9CMx7sPYrMBoZ6aUlmTjEkBJUVQoGczJJKeIYGF2LgHJ5flJsILNxLc5NSizQqwCaCswowB8KSHSTzpcUo-YFVWSlUV9RCIx4t2SkrBEAEFKAxCCxwgek1vRRYrANt1YvJUwaW6KkKGSUlBcVW-vow7flF6fqpefop-cnF-ig69EEOVEgsS8wEVxaoxinkg7NJMdBY7OndFOxKfGkOAA

(Only applicable for extension issues) IDE Information

No response

Activity

  1. added theissue type on Nov 7, 2026
  2. 1-DARK commented on Nov 7, 2026

    @1-DARK
    Contributor

    #claim

  3. github-actions commented on Nov 7, 2026

    @github-actions

    @1-DARK you've claimed this issue — it's now assigned to you. Thanks for picking it up! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions