Menu

#1147 setMethod('copyToR' ... bug

None
closed-fixed
r (8)
5
2022-01-30
2011-03-24
Marie White
No

If I have:

namespace X {
struct Y {
...
};
}

All 'copyToR' methods get parsed like this:

setMethod('copyToR', '_p_X::Y', CopyToR_X__Y)

In R I get:

In matchSignature(signature, fdef, where) :
in the method signature for function "copyToR" no definition for class: “_p_X::Y”

It should be parsed to:

setMethod('copyToR', '_p_X__Y', CopyToR_X__Y)

r-base version 2.10.1-2
swig version 2.0.2

Discussion

  • Marie White

    Marie White - 2011-03-24
    • assigned_to: drjoe --> wsfulton
     
  • William Fulton

    William Fulton - 2011-03-29
    • assigned_to: wsfulton --> drjoe
     
  • William Fulton

    William Fulton - 2011-03-29

    Assigning to Joseph.

     
  • Marie White

    Marie White - 2011-04-12

    in r.cxx, changing the line

    Printf(sfile, "setMethod('copyToR', '_p_%s', CopyToR%s);\n", rclassName,
    mangledName);

    to

    Printf(sfile, "setMethod('copyToR', '_p%s', CopyToR%s);\n", mangledName,
    mangledName);

    fixes it

     
  • Robert Day

    Robert Day - 2012-01-20

    Any update on this? This causes warnings every time the SWIG module is loaded in R.

     
  • Olly Betts

    Olly Betts - 2022-01-29

    Still not fixed:

    $ echo 'namespace X { struct Y { int x, y; }; }' >> Examples/r/class/example.h
    $ make -s -C Examples/r/class
    in method for ‘copyToR’ with signature "_p_X::Y"’: no definition for class “_p_X::Y”
    [1] "Creating some objects:"
    [1] "    Created circle"
    [1] "    Created square"
    [1] "A total of 2 shapes were created"
    [1] "Here is their current position:"
    [1] "    Circle = (20.000000, 30.000000)"
    [1] "    Square = (-10.000000, 5.000000)"
    [1] "Here are some properties of the shapes:"
    [1] "       area = 314.159265 perimeter = 62.831853"
    [2] "       area = 100.000000 perimeter = 40.000000"
    [1] "Guess I'll clean up now"
    NULL
    NULL
    [1] "0 shapes remain"
    [1] "Goodbye"
    

    The suggested fix seems very plausible to me. Will test locally and open a PR.

     
  • Olly Betts

    Olly Betts - 2022-01-30
    • status: open --> closed-fixed
    • Group: -->
     
  • Olly Betts

    Olly Betts - 2022-01-30

    Added a runtime testcase which fails before the change and applied in 781379351167f11873bf15feb78ed500795aecda. Fix will be in SWIG 4.1.0.

     

Log in to post a comment.

MongoDB Logo MongoDB