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

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

[nongnu] elpa/go-mode 8796ec6 446/495: indent: fix floating point litera


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 8796ec6 446/495: indent: fix floating point literal with trailing point
Date: Sat, 7 Aug 2021 09:06:06 -0400 (EDT)

branch: elpa/go-mode
commit 8796ec6ebf8c77c3d6f5c7ebd8902a91e9e8eb57
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>

    indent: fix floating point literal with trailing point
    
    Now we don't mistake "1234." for a dangling ".". Normally one
    adds the zero explicitly, but this is valid and appears once in the
    standard library.
---
 go-mode.el                                          |  6 +++++-
 test/testdata/indentation_tests/numeric_literals.go | 12 ++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/go-mode.el b/go-mode.el
index 18d048c..91f4245 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -558,8 +558,12 @@ The return value is not cached."
   (or
    (and
     (go--line-suffix-p go-dangling-operators-regexp)
+
     ;; "=" does not behave like a dangling operator in decl statements.
-    (not (go--line-suffix-p "\\(?:var\\|type\\|const\\)[[:space:]].*=")))
+    (not (go--line-suffix-p "\\(?:var\\|type\\|const\\)[[:space:]].*="))
+
+    ;; Don't mistake "1234." for a dangling operator.
+    (not (go--line-suffix-p "[[:space:]]-?[[:digit:]][_0-9]*\\.")))
 
    ;; treat comma as dangling operator in certain cases
    (and
diff --git a/test/testdata/indentation_tests/numeric_literals.go 
b/test/testdata/indentation_tests/numeric_literals.go
new file mode 100644
index 0000000..65ef703
--- /dev/null
+++ b/test/testdata/indentation_tests/numeric_literals.go
@@ -0,0 +1,12 @@
+package main
+
+func main() {
+       1234.
+       hi()
+
+       -1234.
+       hi()
+
+       oneTwo3.
+               hi()
+}



reply via email to

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