package org.cafebabepy.runtime.module.builtins;

import org.cafebabepy.annotation.DefinePyFunction;
import org.cafebabepy.annotation.DefinePyType;
import org.cafebabepy.runtime.PyObject;
import org.cafebabepy.runtime.Python;
import org.cafebabepy.runtime.module.AbstractCafeBabePyType;

import static org.cafebabepy.util.ProtocolNames.__str__;

/**
 * Created by yotchang4s on 2017/05/13.
 */
// TODO builtins????
@DefinePyType(name = "builtins.NotImplementedType", appear = false)
public class PyNotImplementedTypeType extends AbstractCafeBabePyType {

    public PyNotImplementedTypeType(Python runtime) {
        super(runtime);
    }

    @DefinePyFunction(name = __str__)
    public PyObject __str__(PyObject self) {
        if (self.getType() instanceof PyNotImplementedTypeType) {
            return this.runtime.str("NotImplemented");

        } else {
            return self.getScope().getOrThrow(__str__).call();
        }
    }
}

@@ -731,36 +731,48 @@
 if (
-self.getType() instanceof Py
+this.runtime.isInstance(self, %22builtins.
 NotI
@@ -785,20 +785,18 @@
 ntedType
-Type
+%22)
 ) %7B%0A    

Fix type check