PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: pysmt/pysmt (python)

Issue:
`SmtLibParser` fails to parse annotations without associated values
When parsing annotations, the parser always tries to read an associated value:
https://github.com/pysmt/pysmt/blob/8aaf1d3309e7402db20fafd6075a9ce7142fed85/pysmt/smtlib/parser/parser.py#L773-L790

However, following the SMT-LIB specs:
```
〈attribute_value〉 ::= 〈spec_constant〉 | 〈symbol〉 | ( 〈s_expr〉∗ )
〈attribute〉 ::= 〈keyword〉 | 〈keyword〉 〈attribute_value〉
```
An attribute can also be a single keyword, without any associated value.

Pull request:
Parse value annotations with ":" as keywords
Fixes #809 


Patch:
diff --git a/pysmt/smtlib/parser/parser.py b/pysmt/smtlib/parser/parser.py
index 40f5ec5..2a14fa9 100644
--- a/pysmt/smtlib/parser/parser.py
+++ b/pysmt/smtlib/parser/parser.py
@@ -773,6 +773,11 @@ class SmtLibParser(object):
             keyword = tk[1:]
             tk = tokens.consume()
             value = None
+            if tk.startswith(":") or tk == ")":
+                # another annotation keyword instead of a value of the previous annotation
+                # add previous annotation with None value and continue to next iteration
+                self.cache.annotations.add(term, keyword, value)
+                continue
             if tk == "(":
                 counter = 1
                 buff = [tk]


Test patch:
diff --git a/pysmt/test/smtlib/test_annotations.py b/pysmt/test/smtlib/test_annotations.py
index bcda7af..8e0b764 100644
--- a/pysmt/test/smtlib/test_annotations.py
+++ b/pysmt/test/smtlib/test_annotations.py
@@ -167,8 +167,10 @@ class TestBasic(TestCase):
         script = parser.get_script(buf)
         ann = script.annotations
         v0 = self.env.formula_manager.get_symbol('"v__AT0"')
-        v1_str = next(iter(ann[v0]["next"]))
-        self.assertEqual(v1_str, ":this_is_considered_a_value")
+        with self.assertRaises(StopIteration):
+            next(iter(ann[v0]["next"]))
+        with self.assertRaises(StopIteration):
+            next(iter(ann[v0]["this_is_considered_a_value"]))
 
 
 if __name__ == '__main__':
Repository: rust-lang/rust-analyzer (rust)

Issue:
Unknown type with `option_env` macro
```Rust
let x = option_env!("CI");
   //^ {unknown}
```
The strange part is that if I use `inline macro` assist, it will work (after manually replacing `$crate` with `core`):
```Rust
let x = core::option::Option::None:: < &str>;
  //^ Option<&str>
```

Pull request:
use `::core` instead of `$crate` in `option_env!`
fix #14885 

Patch:
diff --git a/crates/hir-expand/src/builtin_fn_macro.rs b/crates/hir-expand/src/builtin_fn_macro.rs
index 0640ba774b..7ce5b02314 100644
--- a/crates/hir-expand/src/builtin_fn_macro.rs
+++ b/crates/hir-expand/src/builtin_fn_macro.rs
@@ -820,10 +820,10 @@ fn option_env_expand(
             )
         }
     };
-
+    // FIXME: Use `DOLLAR_CRATE` when that works in eager macros.
     let expanded = match get_env_inner(db, arg_id, &key) {
-        None => quote! { #DOLLAR_CRATE::option::Option::None::<&str> },
-        Some(s) => quote! { #DOLLAR_CRATE::option::Option::Some(#s) },
+        None => quote! { ::core::option::Option::None::<&str> },
+        Some(s) => quote! { ::core::option::Option::Some(#s) },
     };
 
     ExpandResult::ok(ExpandedEager::new(expanded))


Test patch:
diff --git a/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs b/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
index 13aa6130be..006d292992 100644
--- a/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
+++ b/crates/hir-def/src/macro_expansion_tests/builtin_fn_macro.rs
@@ -97,7 +97,7 @@ fn main() { option_env!("TEST_ENV_VAR"); }
 #[rustc_builtin_macro]
 macro_rules! option_env {() => {}}
 
-fn main() { $crate::option::Option::None:: < &str>; }
+fn main() { ::core::option::Option::None:: < &str>; }
 "#]],
     );
 }
diff --git a/crates/hir-ty/src/tests/macros.rs b/crates/hir-ty/src/tests/macros.rs
index 9377a3a5f2..772bd3e536 100644
--- a/crates/hir-ty/src/tests/macros.rs
+++ b/crates/hir-ty/src/tests/macros.rs
@@ -947,7 +947,7 @@ fn infer_builtin_macros_concat_with_lazy() {
 
 #[test]
 fn infer_builtin_macros_env() {
-    check_infer(
+    check_types(
         r#"
         //- /main.rs env:foo=bar
         #[rustc_builtin_macro]
@@ -955,13 +955,26 @@ fn infer_builtin_macros_env() {
 
         fn main() {
             let x = env!("foo");
+              //^ &str
+        }
+        "#,
+    );
+}
+
+#[test]
+fn infer_builtin_macros_option_env() {
+    check_types(
+        r#"
+        //- minicore: option
+        //- /main.rs env:foo=bar
+        #[rustc_builtin_macro]
+        macro_rules! option_env {() => {}}
+
+        fn main() {
+            let x = option_env!("foo");
+              //^ Option<&str>
         }
         "#,
-        expect![[r#"
-            !0..22 '"__RA_...TED__"': &str
-            62..90 '{     ...o"); }': ()
-            72..73 'x': &str
-        "#]],
     );
 }