Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack 샘플 예제 TypeCheck 에러 #2

Open
wants to merge 2 commits into
base: inflearn
Choose a base branch
from

Conversation

rumbarum
Copy link

  1. pyright 의 경우,
while cur_node.pointer.pointer is not None:
    cur_node = cur_node.pointer  

에서 cur_node를 cur_node. pointer 로 찍을때 point 가 None이 아닌지 명시되지 않아서 에러가 나는 걸로 보이구요.

  1. mypy의 경우 result = cur_node.pointer 로 할당 하면, pointer가 None인지 아닌지 mypy에서 알지 못해서 에러가 나는 걸로 보입니다.

amamov and others added 2 commits July 15, 2021 13:17
pyright version 1.1.266, mypy 0.971 에서 Type Check시 에러가 발생하네요

pyright error
-  error: "item" is not a known member of "None" (reportOptionalMemberAccess)
-  error: "pointer" is not a known member of "None" (reportOptionalMemberAccess)
- error: Function with declared type of "T@Stack" must return value
    Type "None" cannot be assigned to type "T@Stack" (reportGeneralTypeIssues)

mypy error
- error: Item "None" of "Optional[Node[Any]]" has no attribute "item"

해당 에러들 안나는 방향으로 수정 했습니다. 
수정 해보니 pyright랑 mypy 랑 잡는 부분이 다르긴 하네요.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants