Skip to content

unsupported operand type(s) for !=: '{str:str}' and '{any:any}', compare dict and schema instance #2049

Description

@Mr-Czt

Bug Report

1. Minimal reproduce step (Required)

use '==' compares the dict value and schema instance, which works properly. use '!=', The comparison is not supported by the compilation.

schema Person:
    name?: str
    age?: int

_person = {name: "Tom"}    # default
_is_empty = True
if _person == {}:
    _is_empty = True
else:
    _is_empty = False
is_empty = _is_empty
schema Person:
    name?: str
    age?: int

_person = {name: "Tom"}    # default
_is_empty = True
if _person != {}:
    _is_empty = False
else:
    _is_empty = True

is_empty = _is_empty

2. What did you expect to see? (Required)

上述两种方式,使用‘==’和‘!=’运算符,都应该可以工作

3. What did you see instead (Required)

可以使用'=='比较,不支持'!=',compile error

Image

4. What is your KCL components version? (Required)

kcl version 0.12.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsemanticIssues or PRs related to kcl semantic and checker

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions