branch: elpa/go-mode commit 7dc64c7d9f7f3620632bbcf2fe24c1085fa7eabb Author: Muir Manders <m...@mnd.rs> Commit: Dominik Honnef <domi...@honnef.co>
Fix false positive type alias fontification. We were interpreting "typeFoo = 123" as a type alias due to a bug in the regex. Closes: gh-404 [via git-merge-pr] --- go-mode.el | 2 +- test/go-font-lock-test.el | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go-mode.el b/go-mode.el index b40203039f..85acc2cb73 100644 --- a/go-mode.el +++ b/go-mode.el @@ -1614,7 +1614,7 @@ func foo(i int) string" found-match)) (defconst go--type-alias-re - (concat "^[[:space:]]*\\(type\\)?[[:space:]]*" go-identifier-regexp "[[:space:]]*=[[:space:]]*" go-type-name-regexp)) + (concat "^[[:space:]]*\\(type[[:space:]]+\\)?" go-identifier-regexp "[[:space:]]*=[[:space:]]*" go-type-name-regexp)) (defun go--match-type-alias (end) "Search for type aliases. diff --git a/test/go-font-lock-test.el b/test/go-font-lock-test.el index c943fe4911..3bca76d737 100644 --- a/test/go-font-lock-test.el +++ b/test/go-font-lock-test.el @@ -158,7 +158,9 @@ KtypeK ( TfooT TbarT TfooT KstructK {} TfooT = *Tbar.ZarT -)")) +)") + + (go--should-fontify "typeName = abc")) (ert-deftest go--fontify-var-decl () (go--should-fontify "KvarK VfooV = bar")