@@ -182,9 +182,25 @@ Object doGeneric(Object self, Object other) {
182182 @ GenerateNodeFactory
183183 abstract static class SubNode extends PythonBinaryBuiltinNode {
184184 @ Specialization
185- PBaseSet doKeysView (PDictKeysView left , PDictKeysView right ,
185+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
186186 @ Cached ("create()" ) HashingStorageNodes .DiffNode diffNode ) {
187- HashingStorage storage = diffNode .execute (left .getDict ().getDictStorage (), right .getDict ().getDictStorage ());
187+ HashingStorage storage = diffNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ());
188+ return factory ().createSet (storage );
189+ }
190+
191+ @ Specialization
192+ PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
193+ @ Cached ("create()" ) HashingStorageNodes .DiffNode diffNode ) {
194+ HashingStorage storage = diffNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ());
195+ return factory ().createSet (storage );
196+ }
197+
198+ @ Specialization
199+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
200+ @ Cached ("create()" ) HashingStorageNodes .DiffNode diffNode ,
201+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
202+ PSet selfSet = constructSetNode .executeWith (self );
203+ HashingStorage storage = diffNode .execute (selfSet .getDictStorage (), other .getDictStorage ());
188204 return factory ().createSet (storage );
189205 }
190206
@@ -202,13 +218,29 @@ PBaseSet doItemsView(PDictItemsView self, PDictItemsView other,
202218 @ Builtin (name = __AND__ , fixedNumOfArguments = 2 )
203219 @ GenerateNodeFactory
204220 abstract static class AndNode extends PythonBinaryBuiltinNode {
221+ @ Specialization
222+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
223+ @ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ) {
224+ HashingStorage intersectedStorage = intersectNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ());
225+ return factory ().createSet (intersectedStorage );
226+ }
227+
205228 @ Specialization
206229 PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
207230 @ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ) {
208231 HashingStorage intersectedStorage = intersectNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ());
209232 return factory ().createSet (intersectedStorage );
210233 }
211234
235+ @ Specialization
236+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
237+ @ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ,
238+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
239+ PSet selfSet = constructSetNode .executeWith (self );
240+ HashingStorage intersectedStorage = intersectNode .execute (selfSet .getDictStorage (), other .getDictStorage ());
241+ return factory ().createSet (intersectedStorage );
242+ }
243+
212244 @ Specialization
213245 PBaseSet doItemsView (PDictItemsView self , PDictItemsView other ,
214246 @ Cached ("create()" ) HashingStorageNodes .IntersectNode intersectNode ,
@@ -223,12 +255,26 @@ PBaseSet doItemsView(PDictItemsView self, PDictItemsView other,
223255 @ Builtin (name = __OR__ , fixedNumOfArguments = 2 )
224256 @ GenerateNodeFactory
225257 public abstract static class OrNode extends PythonBuiltinNode {
258+ @ Specialization
259+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
260+ @ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ) {
261+ return factory ().createSet (unionNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ()));
262+ }
263+
226264 @ Specialization
227265 PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
228266 @ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ) {
229267 return factory ().createSet (unionNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ()));
230268 }
231269
270+ @ Specialization
271+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
272+ @ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ,
273+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
274+ PSet selfSet = constructSetNode .executeWith (self );
275+ return factory ().createSet (unionNode .execute (selfSet .getDictStorage (), other .getDictStorage ()));
276+ }
277+
232278 @ Specialization
233279 PBaseSet doItemsView (PDictItemsView self , PDictItemsView other ,
234280 @ Cached ("create()" ) HashingStorageNodes .UnionNode unionNode ,
@@ -242,12 +288,26 @@ PBaseSet doItemsView(PDictItemsView self, PDictItemsView other,
242288 @ Builtin (name = __XOR__ , fixedNumOfArguments = 2 )
243289 @ GenerateNodeFactory
244290 public abstract static class XorNode extends PythonBuiltinNode {
291+ @ Specialization
292+ PBaseSet doKeysView (PDictKeysView self , PBaseSet other ,
293+ @ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ) {
294+ return factory ().createSet (xorNode .execute (self .getDict ().getDictStorage (), other .getDictStorage ()));
295+ }
296+
245297 @ Specialization
246298 PBaseSet doKeysView (PDictKeysView self , PDictKeysView other ,
247299 @ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ) {
248300 return factory ().createSet (xorNode .execute (self .getDict ().getDictStorage (), other .getDict ().getDictStorage ()));
249301 }
250302
303+ @ Specialization
304+ PBaseSet doItemsView (PDictItemsView self , PBaseSet other ,
305+ @ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ,
306+ @ Cached ("create()" ) SetNodes .ConstructSetNode constructSetNode ) {
307+ PSet selfSet = constructSetNode .executeWith (self );
308+ return factory ().createSet (xorNode .execute (selfSet .getDictStorage (), other .getDictStorage ()));
309+ }
310+
251311 @ Specialization
252312 PBaseSet doItemsView (PDictItemsView self , PDictItemsView other ,
253313 @ Cached ("create()" ) HashingStorageNodes .ExclusiveOrNode xorNode ,
0 commit comments