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

wrong-type-argument when `srefactor-refactor-at-point` #42

Closed
whatacold opened this Issue Jun 27, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@whatacold
Contributor

whatacold commented Jun 27, 2018

Hi,

What this package provides is what I desired for some time, it's awesome, thanks for this packages.

So I give it a shot today, but it throws a wrong-type-argument error :(, the backtrace is:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  srefactor--tag-name(("Foo" function (:prototype-flag t :destructor-flag t :typemodifiers ("virtual") :type "void") (reparse-symbol classsubparts) #<overlay in no buffer>))
  srefactor--insert-function(("Foo" function (:prototype-flag t :destructor-flag t :typemodifiers ("virtual") :type "void") (reparse-symbol classsubparts) #<overlay in no buffer>) gen-func-impl)
  srefactor--insert-tag(("Foo" function (:prototype-flag t :destructor-flag t :typemodifiers ("virtual") :type "void") (reparse-symbol classsubparts) #<overlay in no buffer>) nil gen-func-impl)
  srefactor--refactor-tag(#<buffer foo.h> ("Foo" function (:prototype-flag t :destructor-flag t :typemodifiers ("virtual") :type "void") (reparse-symbol classsubparts) #<overlay in no buffer>) gen-func-impl)
  srefactor--refactor-type(#<buffer foo.h> ("Foo" type (:members (("public" label nil (reparse-symbol classsubparts) #<overlay in no buffer>) ("Foo" function (:prototype-flag t :constructor-flag t :type ("Foo" type (:type "class") nil nil)) (reparse-symbol classsubparts) #<overlay in no buffer>) ("Foo" function (:prototype-flag t :destructor-flag t :typemodifiers ("virtual") :type "void") (reparse-symbol classsubparts) #<overlay in no buffer>)) :type "class") nil #<overlay in no buffer>))
  srefactor--refactor-based-on-tag-class(gen-func-impl "(Other file)")
  srefactor-ui--refactor-action((link :tag #("[2] Generate Function Implementation (Other file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (gen-func-impl ("(File)" "(Other file)" "(Current file)")) :parent (group :args ((link :tag #("[1] Move (Current file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (move ("(File)" "(Other file)" "(Current file)"))) (link :tag #("[2] Generate Function Implementation (Other file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (gen-func-impl ("(File)" "(Other file)" "(Current file)")))) :indent 2 :format "\n%v\n" :children ((link :tag #("[1] Move (Current file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (move ("(File)" "(Other file)" "(Current file)")) :parent #1 :indent 2 :button-overlay #<overlay in no buffer> :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) #0) :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) :indent 2 :button-overlay #<overlay in no buffer> :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) nil)
  widget-apply((link :tag #("[2] Generate Function Implementation (Other file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (gen-func-impl ("(File)" "(Other file)" "(Current file)")) :parent (group :args ((link :tag #("[1] Move (Current file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (move ("(File)" "(Other file)" "(Current file)"))) (link :tag #("[2] Generate Function Implementation (Other file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (gen-func-impl ("(File)" "(Other file)" "(Current file)")))) :indent 2 :format "\n%v\n" :children ((link :tag #("[1] Move (Current file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (move ("(File)" "(Other file)" "(Current file)")) :parent #1 :indent 2 :button-overlay #<overlay in no buffer> :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) #0) :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) :indent 2 :button-overlay #<overlay in no buffer> :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) :action nil)
  widget-apply-action((link :tag #("[2] Generate Function Implementation (Other file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (gen-func-impl ("(File)" "(Other file)" "(Current file)")) :parent (group :args ((link :tag #("[1] Move (Current file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (move ("(File)" "(Other file)" "(Current file)"))) (link :tag #("[2] Generate Function Implementation (Other file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (gen-func-impl ("(File)" "(Other file)" "(Current file)")))) :indent 2 :format "\n%v\n" :children ((link :tag #("[1] Move (Current file)" 1 2 (face font-lock-preprocessor-face mouse-face italic)) :button-prefix "" :button-suffix "" :button-face nil :format "%[%t\n%]" :help-echo "" :action srefactor-ui--refactor-action :args nil :value (move ("(File)" "(Other file)" "(Current file)")) :parent #1 :indent 2 :button-overlay #<overlay in no buffer> :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) #0) :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) :indent 2 :button-overlay #<overlay in no buffer> :from #<marker (moves after insertion) in no buffer> :to #<marker in no buffer>) nil)
  widget-button-press(180)
  funcall-interactively(widget-button-press 180)
  call-interactively(widget-button-press nil nil)
  command-execute(widget-button-press)

I tested it with a C++ class in foo.h with c++-mode enabled:

class Foo
{
public:
    Foo();
    virtual ~Foo();
};

And I M-x srefactor-refactor-at-point when point is at {, and select option 2: Generate Function Implementation (Other file).
Then the error occurs and somehow foo.h is changed to(foo.c is created but empty, with c-mode as major mode):

class Foo
{
public:
    Foo();
    virtual ~Foo();
};



Foo::Foo() {
  
}

I tested this with a clean Emacs by running emacs -Q -l /tmp/clean.el, where /tmp/clean.el is:

(require 'package)
(setq package-archives
      '(("gnu" . "http://mirrors.163.com/elpa/gnu/")
        ("melpa" . "http://mirrors.163.com/elpa/melpa/")
        ("melpa-stable" . "http://mirrors.163.com/elpa/melpa-stable/")))
(setq package-user-dir "/tmp/elpa/")
(package-refresh-contents)
(package-initialize)

(package-install 'srefactor)
(semantic-mode 1)

Emacs version: GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.19) of 2017-09-15
Semantic-Refactor version(seen from M-x list-packages): 20170223.540

@whatacold whatacold changed the title from rong-type-argument stringp nil when `srefactor-refactor-at-point` to wrong-type-argument when `srefactor-refactor-at-point` Jun 27, 2018

@whatacold

This comment has been minimized.

Show comment
Hide comment
@whatacold

whatacold Jul 3, 2018

Contributor

Hi tuhdo,

I've fixed this in pr #43

Contributor

whatacold commented Jul 3, 2018

Hi tuhdo,

I've fixed this in pr #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment