You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on type checking generic params for the nominal-connection-checker, and there's an issue where if you insert a generic param block between two other blocks it blows up. In the bellow case I can no longer interact with the workspace because of errors:
First of all the insertion marker shouldn't even show up there, but I'll file a separate issue for that. This is a different issue because you also get errors when you connect the block programmatically. In the below case I can't set down the block because of errors:
I believe this is caused because of how connect_ tries to insert a block X between two blocks A and B:
Checks that X and A are compatible
Disconnects B from A
Tries to connect B to X
3.1) Checks that B and X are compatible
3.2) Connects B to X
Connects X to A
So in the case above A is the SelectRandom block, B is the GetterList[Dog] block, and X is the GetterList[T] block. We'll call the other GetterList[Dog] block C.
A is compatible with X because GetterList[T] has a common super type with C's GetterList[Dog] type.
B gets disconnected from A
Tries to connect B to X
3.1) B is compatible with X because GetterList[Dog] is compatible with the simple generic T
3.2) Connects B to X
Connects X to A
But step 4 is now erroneous. After step 3.2 the type of X is now GetterList[GetterList[Dog]], which is not compatible with the GetterList[Dog] check from block C.
Solution
I think that what needs to happen is steps 3 and 4 need to be swapped. We should only try to reconnect the orphan after the new parent has been connected, incase the state of the new parent changes when it is connected.
As you can see, if we do this manually, the nominal-connection-checker performs as expected:
The other option would be to re-check that X and A are compatible before step 4, but I don't think this makes sense from the perspective of a developer programmatically connecting blocks. If they are trying to programmatically connect X to A, and instead it gets connected to B and then bumped, that doesn't make sense.
Does anyone have thoughts about this before I give it a shot?
The text was updated successfully, but these errors were encountered:
Problem
I'm working on type checking generic params for the nominal-connection-checker, and there's an issue where if you insert a generic param block between two other blocks it blows up. In the bellow case I can no longer interact with the workspace because of errors:
First of all the insertion marker shouldn't even show up there, but I'll file a separate issue for that. This is a different issue because you also get errors when you connect the block programmatically. In the below case I can't set down the block because of errors:
I believe this is caused because of how connect_ tries to insert a block X between two blocks A and B:
3.1) Checks that B and X are compatible
3.2) Connects B to X
So in the case above A is the
SelectRandom
block, B is theGetterList[Dog]
block, and X is theGetterList[T]
block. We'll call the otherGetterList[Dog]
block C.GetterList[T]
has a common super type with C'sGetterList[Dog]
type.3.1) B is compatible with X because
GetterList[Dog]
is compatible with the simple genericT
3.2) Connects B to X
But step 4 is now erroneous. After step 3.2 the type of X is now
GetterList[GetterList[Dog]]
, which is not compatible with theGetterList[Dog]
check from block C.Solution
I think that what needs to happen is steps 3 and 4 need to be swapped. We should only try to reconnect the orphan after the new parent has been connected, incase the state of the new parent changes when it is connected.
As you can see, if we do this manually, the nominal-connection-checker performs as expected:
The other option would be to re-check that X and A are compatible before step 4, but I don't think this makes sense from the perspective of a developer programmatically connecting blocks. If they are trying to programmatically connect X to A, and instead it gets connected to B and then bumped, that doesn't make sense.
Does anyone have thoughts about this before I give it a shot?
The text was updated successfully, but these errors were encountered: