Read about our upcoming Code of Conduct on this issue

Commit 94591055 authored by Ronan Lamy's avatar Ronan Lamy
Browse files

Don't derive SomeNone from SomePBC

parent a57283e9fbd9
......@@ -453,9 +453,6 @@ class Bookkeeper(object):
attr = s_attr.const
descs = list(pbc.descriptions)
if not descs:
return s_ImpossibleValue
first = descs[0]
if len(descs) == 1:
return first.s_read_attribute(attr)
......@@ -496,8 +493,6 @@ class Bookkeeper(object):
annotations).
"""
descs = list(pbc.descriptions)
if not descs:
return s_ImpossibleValue
first = descs[0]
first.mergecallfamilies(*descs[1:])
......
......@@ -513,7 +513,7 @@ class SomePBC(SomeObject):
else:
return kt.__name__
class SomeNone(SomePBC):
class SomeNone(SomeObject):
can_be_None = True
subset_of = None
knowntype = type(None)
......
......@@ -106,12 +106,11 @@ class Sig(object):
for i, argtype in enumerate(self.argtypes):
if isinstance(argtype, (types.FunctionType, types.MethodType)):
argtype = argtype(*inputcells)
if isinstance(argtype, lltype.LowLevelType) and\
argtype is lltype.Void:
if argtype is lltype.Void:
# XXX the mapping between Void and annotation
# is not quite well defined
s_input = inputcells[i]
assert isinstance(s_input, annmodel.SomePBC)
assert isinstance(s_input, (annmodel.SomePBC, annmodel.SomeNone))
assert s_input.is_constant()
args_s.append(s_input)
elif argtype is None:
......
......@@ -760,9 +760,16 @@ class __extend__(SomeNone):
def bind_callables_under(self, classdef, name):
return self
def getattr(self, s_attr):
return s_ImpossibleValue
getattr.can_only_throw = []
def setattr(self, s_attr, s_value):
return None
def call(self, args):
return s_ImpossibleValue
def bool_behavior(self, s):
s.const = False
......
......@@ -56,6 +56,9 @@ class LowLevelAnnotatorPolicy(AnnotatorPolicy):
assert s_obj.is_constant(), "ambiguous low-level helper specialization"
key.append(KeyComp(s_obj.const))
new_args_s.append(s_obj)
elif isinstance(s_obj, annmodel.SomeNone):
key.append(KeyComp(None))
new_args_s.append(s_obj)
else:
new_args_s.append(annmodel.not_const(s_obj))
try:
......
......@@ -885,7 +885,7 @@ class LowLevelOpList(list):
s_value = rtyper.binding(v, default=annmodel.s_None)
if not s_value.is_constant():
raise TyperError("non-constant variable of type Void")
if not isinstance(s_value, annmodel.SomePBC):
if not isinstance(s_value, (annmodel.SomePBC, annmodel.SomeNone)):
raise TyperError("non-PBC Void argument: %r", (s_value,))
args_s.append(s_value)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment