File 0824-Ensure-that-erl_anno-location-1-does-not-return-unde.patch of Package erlang

From 0897cb3163e4bd897f10479e9c5e74992f41eaa2 Mon Sep 17 00:00:00 2001
From: Richard Carlsson <carlsson.richard@gmail.com>
Date: Thu, 2 Jan 2025 10:41:26 +0100
Subject: [PATCH 4/4] Ensure that erl_anno:location/1 does not return
 `undefined`

The type spec of erl_anno:location/1 does not include returning the
atom `undefined`, but this would happen if an annotation list did not
contain a `{location,L}` entry, e.g. for an empty list.
---
 lib/stdlib/src/erl_anno.erl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/stdlib/doc/src/erl_anno.xml b/lib/stdlib/doc/src/erl_anno.xml
index 976c9b41a1..882135711a 100644
--- a/lib/stdlib/doc/src/erl_anno.xml
+++ b/lib/stdlib/doc/src/erl_anno.xml
@@ -207,7 +207,8 @@
       <fsummary>Return the location.</fsummary>
       <type name="location"></type>
       <desc>
-        <p>Returns the location of the annotations <anno>Anno</anno>.</p>
+        <p>Returns the location of the annotations <anno>Anno</anno>.
+          If there is no location, a zero line number is returned.</p>
       </desc>
     </func>
 
diff --git a/lib/stdlib/src/erl_anno.erl b/lib/stdlib/src/erl_anno.erl
index 976c9b41a1..882135711a 100644
--- a/lib/stdlib/src/erl_anno.erl
+++ b/lib/stdlib/src/erl_anno.erl
@@ -231,7 +231,7 @@ location(Line) when ?ALINE(Line) ->
 location({Line, Column}=Location) when ?ALINE(Line), ?ACOLUMN(Column) ->
     Location;
 location(Anno) ->
-    anno_info(Anno, location).
+    anno_info(Anno, location, 0).
 
 -spec record(Anno) -> record() when
       Anno :: anno().
-- 
2.43.0

openSUSE Build Service is sponsored by