-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug with derivative operator in Fraction context #1168
Comments
Try applying this patch to the diff --git a/macros/contexts/contextExtensions.pl b/macros/contexts/contextExtensions.pl
index 72833110..13fd075c 100644
--- a/macros/contexts/contextExtensions.pl
+++ b/macros/contexts/contextExtensions.pl
@@ -449,6 +449,19 @@ sub extensionContext {
return $class;
}
+#
+# Trap calls to methods in the super-class that aren't overridden in the subclass
+# and perform the super-class method with the given arguments.
+#
+sub AUTOLOAD {
+ my $self = shift;
+ my $name = $AUTOLOAD;
+ $name =~ s/.*:://;
+ my $meth = $self->super($name);
+ return &$meth($self, @_) if ref($meth) eq 'CODE';
+ die "Undefined method $name for " . ref($self);
+}
+ |
@dpvc I tested your patch, and it does fix the original issue with the
|
OK, thanks. I'll have to look into it further. I was afraid there might be unwanted side effects. I may be able to make a smarter function for handling it,. |
I added |
Try changing the #
# Trap calls to methods that aren't overridden in the subclass
# and perform the super-class method with the given arguments.
#
sub AUTOLOAD {
my $self = @_[0];
my $name = $AUTOLOAD;
$name =~ s/.*:://;
my $meth = $self->super($name);
goto &$meth if ref($meth) eq 'CODE';
} and see if that is better. |
I too can confirm that adding |
@dpvc Your recent suggestion didn't stop the warnings, I still see them. In addition I get the following |
OOPS, yes, I don't see how you can still be getting the message because the line that produced is has been removed. Are you sure the correct macro file is loading? Or are they just similar messages? The message
was generated by the |
I didn't look at the warnings that closely so yes, they are different. Here they are.
|
OK, here is another try: sub AUTOLOAD {
my ($self) = @_;
my $name = $AUTOLOAD;
$name =~ s/.*:://;
my $meth = $self->context ? $self->super($name) : undef;
goto &$meth if ref($meth) eq 'CODE';
} |
That appears to fix all the warnings for me. Thanks. |
The latest is working for me, and the original exercise that led to this report is working as expected now. Thanks! |
I think this may be a slightly better solution is diff --git a/macros/contexts/contextExtensions.pl b/macros/contexts/contextExtensions.pl
index 72833110..c56f065e 100644
--- a/macros/contexts/contextExtensions.pl
+++ b/macros/contexts/contextExtensions.pl
@@ -423,6 +423,10 @@ sub new {
return &{ $self->super("new", $context) }($self, @_);
}
+sub context {
+ return Value::context(@_);
+}
+
#
# Get the object's class from its class name
#
@@ -449,6 +453,18 @@ sub extensionContext {
return $class;
}
+#
+# Trap calls to methods that aren't overridden in the subclass
+# and perform the super-class method with the given arguments.
+#
+sub AUTOLOAD {
+ my ($self) = @_;
+ my $name = $AUTOLOAD;
+ $name =~ s/.*:://;
+ my $meth = $self->super($name);
+ goto &$meth if ref($meth) eq 'CODE';
+}
+
#################################################################################################
################################################################################################# as this avoids a potential infinite loop with the |
I have reconsidered my That makes the new classes not really subclasses or the original, but a kind of "pass through" to the original when they don't come into play. So that means we don't want the In this case, that means we need to implement the I have made a PR for what I think is the correct solution to this problem, so I would remove the changes I suggested above, and try this new PR instead. |
On
develop
, here is a MWE of something that causes an error, but it does not cause an error in 2.19:I boiled this down from a complicated exercise that was reported broken since I moved our server to develop. I can avoid the error by not setting
reduceConstants=>0
. However doing so causes some other issue (cosmetic issues, not PG errors).The text was updated successfully, but these errors were encountered: