Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Multiple Supports are not added to a single type #249

Copy link
Copy link

Description

@sobolevn
Issue body actions

This code:

from classes import AssociatedType, Supports, typeclass

class A(AssociatedType):
    ...

class B(AssociatedType):
    ...

@typeclass(A)
def one(instance) -> bool:
    ...

@one.instance(int)
def _one_int(instance: int) -> bool:
    ...

@typeclass(B)
def two(instance) -> bool:
    ...

@two.instance(int)
def _two_int(instance: int) -> bool:
    ...


a: Supports[A] = 1
b: Supports[B] = 1

does not work:

ex.py:35: error: Incompatible types in assignment (expression has type "int", variable has type "Supports[B]")

This happens because of this line:

if supports_spec.type not in instance_type.type.mro:

We only add one Supports type to each instance.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.