Move deprecation alerts to valid location

As discussed in https://github.com/ocaml/ocaml/issues/14078,
alerts (with deprecation alerts as a special case) are not currently
supported as item-attributes on let-bindings. This usage produces
`misplaced-attribute` warnings, such as

```
Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context
File "src/core/opentelemetry.ml", line 1229, characters 37-47:
1229 |   let add_event = Scope.add_event [@@deprecated "use Scope.add_event"]
                                            ^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context

File "src/core/opentelemetry.ml", line 1231, characters 37-47:
1231 |   let add_attrs = Scope.add_attrs [@@deprecated "use Scope.add_attrs"]
                                            ^^^^^^^^^^
Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context
```

Fortunately, we can still add deprecation alerts to these value by
moving the alert to the pattern, as done here.
This commit is contained in:
Shon Feder 2025-06-07 10:56:56 -04:00
parent 885d0b6a75
commit e66476015b
No known key found for this signature in database

View file

@ -1226,9 +1226,9 @@ module Trace = struct
}
[@@deprecated "use Scope.t"]
let add_event = Scope.add_event [@@deprecated "use Scope.add_event"]
let (add_event [@deprecated "use Scope.add_event"]) = Scope.add_event
let add_attrs = Scope.add_attrs [@@deprecated "use Scope.add_attrs"]
let (add_attrs [@deprecated "use Scope.add_attrs"]) = Scope.add_attrs
let with_' ?(force_new_trace_id = false) ?trace_state ?service_name
?(attrs : (string * [< value ]) list = []) ?kind ?trace_id ?parent ?scope