emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/go-mode 7dc64c7d9f 2/3: Fix false positive type alias font


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 7dc64c7d9f 2/3: Fix false positive type alias fontification.
Date: Tue, 26 Jul 2022 21:58:30 -0400 (EDT)

branch: elpa/go-mode
commit 7dc64c7d9f7f3620632bbcf2fe24c1085fa7eabb
Author: Muir Manders <muir@mnd.rs>
Commit: Dominik Honnef <dominik@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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]