File 0194-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/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
@@ -328,7 +328,10 @@ line(Anno) ->
             Line
     end.
 
--doc "Returns the location of the annotations Anno.".
+-doc """
+Returns the location of the annotations Anno. If there is no location,
+a zero line number is returned.
+""".
 -doc(#{since => <<"OTP 18.0">>}).
 -spec location(Anno) -> location() when
       Anno :: anno().
@@ -338,7 +341,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).
 
 -doc false.
 -spec record(Anno) -> record() when
-- 
2.43.0

openSUSE Build Service is sponsored by