File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1380,12 +1380,6 @@ struct CAFFE2_API ClassType : public Type {
13801380 return false ;
13811381 }
13821382
1383- bool isSubtypeOf (const TypePtr rhs) const override {
1384- // XXX: We do not have inheritance implemented, only types that are the
1385- // same can subtype from each other.
1386- return *this == *rhs;
1387- }
1388-
13891383 std::string str () const override {
13901384 return std::string (" ClassType<" ) + name_.name () + " >" ;
13911385 }
Original file line number Diff line number Diff line change @@ -16050,6 +16050,17 @@ def copy(self):
1605016050 other.stack = list(self.stack)
1605116051 return other
1605216052
16053+ def test_optional_type_promotion(self):
16054+ # should not throw
16055+ @torch.jit.script # noqa: B903
16056+ class Tree(object):
16057+ def __init__(self):
16058+ self.parent = torch.jit.annotate(Optional[Tree], None)
16059+
16060+ def add_child(self, child):
16061+ # type: (Tree) -> None
16062+ child.parent = torch.jit.annotate(Optional[Tree], self)
16063+
1605316064
1605416065class TestLogging(JitTestCase):
1605516066 def test_bump_numeric_counter(self):
You can’t perform that action at this time.
0 commit comments