diff --git a/lib/type1.g b/lib/type1.g index 6d85e3dfd8..bbcd980143 100644 --- a/lib/type1.g +++ b/lib/type1.g @@ -569,13 +569,6 @@ BIND_GLOBAL( "FlagsObj", obj -> FlagsType( TypeObj( obj ) ) ); BIND_GLOBAL( "DataObj", obj -> DataType( TypeObj( obj ) ) ); -BIND_GLOBAL( "IsNonAtomicComponentObjectRepFlags", - FLAGS_FILTER(IsNonAtomicComponentObjectRep)); -BIND_GLOBAL( "IsAtomicPositionalObjectRepFlags", - FLAGS_FILTER(IsAtomicPositionalObjectRep)); -BIND_GLOBAL( "IsReadOnlyPositionalObjectRepFlags", - FLAGS_FILTER(IsReadOnlyPositionalObjectRep)); - ############################################################################# ## #F Objectify( , ) @@ -592,26 +585,40 @@ BIND_GLOBAL( "Objectify", function ( type, obj ) if not IsType( type ) then Error(" must be a type"); fi; + flags := FlagsType(type); if IsHPCGAP then - flags := FlagsType(type); if IS_LIST( obj ) then - if IS_SUBSET_FLAGS(flags, IsAtomicPositionalObjectRepFlags) then + if IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsAtomicPositionalObjectRep)) then FORCE_SWITCH_OBJ( obj, FixedAtomicList(obj) ); fi; elif IS_REC( obj ) then if IS_ATOMIC_RECORD(obj) then - if IS_SUBSET_FLAGS(flags, IsNonAtomicComponentObjectRepFlags) then + if IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsNonAtomicComponentObjectRep)) then FORCE_SWITCH_OBJ( obj, FromAtomicRecord(obj) ); fi; - elif not IS_SUBSET_FLAGS(flags, IsNonAtomicComponentObjectRepFlags) then + elif not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsNonAtomicComponentObjectRep)) then FORCE_SWITCH_OBJ( obj, AtomicRecord(obj) ); fi; fi; fi; if IS_LIST( obj ) then + #Assert(0, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep))); + Assert(0, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep))); + if not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep)) then + INFO_DEBUG(1, "Objectify: type does not imply IsPositionalObjectRep ", + INPUT_FILENAME(), ":", STRING_INT(INPUT_LINENUMBER())); + fi; SET_TYPE_POSOBJ( obj, type ); elif IS_REC( obj ) then + #Assert(0, IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep))); + Assert(0, not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsPositionalObjectRep))); + if not IS_SUBSET_FLAGS(flags, FLAGS_FILTER(IsComponentObjectRep)) then + INFO_DEBUG(1, "Objectify: type does not imply IsComponentObjectRep ", + INPUT_FILENAME(), ":", STRING_INT(INPUT_LINENUMBER())); + fi; SET_TYPE_COMOBJ( obj, type ); + else + Error(" must be a list or a record"); fi; if not ( IGNORE_IMMEDIATE_METHODS or IsNoImmediateMethodsObject(obj) ) then diff --git a/tst/testinstall/kernel/gap.tst b/tst/testinstall/kernel/gap.tst index a105593b31..b0a51cf10c 100644 --- a/tst/testinstall/kernel/gap.tst +++ b/tst/testinstall/kernel/gap.tst @@ -7,7 +7,7 @@ gap> START_TEST("kernel/gap.tst"); # in ViewObj; afterwards everything should still work as before gap> l := [ ~ ];; r := rec(a:=~);; gap> cat := NewCategory("IsMockObject", IsObject);; -gap> type := NewType(NewFamily("MockFamily"), cat);; +gap> type := NewType(NewFamily("MockFamily"), cat and IsPositionalObjectRep);; gap> InstallMethod(ViewObj, [cat], function(s) Error("oops"); end); gap> InstallMethod(PrintObj, [cat], function(s) Error("uups"); end); gap> x:=Objectify(type,[]); r; Print(l, "\n"); diff --git a/tst/testinstall/kernel/opers.tst b/tst/testinstall/kernel/opers.tst index 2013864ec0..b4fa24ce45 100644 --- a/tst/testinstall/kernel/opers.tst +++ b/tst/testinstall/kernel/opers.tst @@ -294,7 +294,7 @@ gap> CLEAR_CACHE_INFO(); gap> opcheck := OPERS_CACHE_INFO();; #@if GAPInfo.KernelInfo.KernelDebug and IsHPCGAP gap> opcheck{[1..11]}; -[ 2, 0, 0, 6, 0, 0, 6, 0, 0, 2, 0 ] +[ 2, 0, 0, 6, 0, 0, 10, 0, 0, 2, 0 ] #@fi # FIXME: the following code skips entry 4 (OperationHit, which is normally @@ -338,7 +338,7 @@ gap> opcheck{[1..11]}; # #@if GAPInfo.KernelInfo.KernelDebug and not IsHPCGAP gap> opcheck{Difference([1..11], [4])}; -[ 2, 0, 0, 0, 0, 4, 0, 0, 2, 0 ] +[ 2, 0, 0, 0, 0, 8, 0, 0, 2, 0 ] #@fi #@if not GAPInfo.KernelInfo.KernelDebug gap> opcheck{[1..11]}; diff --git a/tst/testinstall/object.tst b/tst/testinstall/object.tst index b51e34ecc4..422f492a5b 100644 --- a/tst/testinstall/object.tst +++ b/tst/testinstall/object.tst @@ -4,7 +4,7 @@ gap> START_TEST("object.tst"); # test some standard object types -gap> r := Objectify(TYPE_KERNEL_OBJECT, rec()); +gap> r := [];; SET_TYPE_DATOBJ(r,TYPE_KERNEL_OBJECT); gap> KnownAttributesOfObject(r); [ ]