PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: brigand/babel-plugin-flow-react-proptypes (js)
Issue: Error when union types
Hello. When I try union types with three dots, then i get this error:
`Cannot read property 'forEach' of undefined
at convertToPropTypes node_modules/babel-plugin-flow-react-proptypes/lib/convertToPropTypes.js:185:19`

Example:
```javascript
// file foo.js
export type WithId = {|
  fooId: string,
|}
```
```javascript
// file bar.js
import type { WithId } from './foo'

export type Bar = {|
  name: string,
  ...WithId,
|}
```
```javascript
import type { Bar } from './bar'

type Props = {
  bar: Bar,
}
```

Why?
Pull request description: fixes error for spread on imported type, resolves #204
Minimal example, where we import a type, and then try to spread it:

```js
import { type Foo } from './Foo';

export type Something = {
   ...Foo,
}
```

This change causes it not to error, however we just eliminate the spread for now.

To actually support this, we'd need to wrap the spread type in a custom fake propTypes function, like this:

```js
const bpfrpt_proptype_Something = {
  __made_up_prop: (...args) => {
    // apply `bpfrpt_proptype_Foo` to the props object
  }
}
```

If anyone wants to try implementing this and has time to test it well, that'd be great.

Patch:
diff --git a/src/convertToPropTypes.js b/src/convertToPropTypes.js
index 562f79a..de718f3 100644
--- a/src/convertToPropTypes.js
+++ b/src/convertToPropTypes.js
@@ -166,6 +166,11 @@ export default function convertToPropTypes(node, importedTypes, internalTypes) {
     }
 
     const spreadShape = convertToPropTypes(subnode, importedTypes, internalTypes);
+
+    if (spreadShape.type === 'raw') {
+      return [];
+    }
+
     const properties = spreadShape.properties;
 
     // Unless or until the strange default behavior changes in flow (https://github.com/facebook/flow/issues/3214)


Test patch:
diff --git a/src/__tests__/__snapshots__/imported-spread-test.js.snap b/src/__tests__/__snapshots__/imported-spread-test.js.snap
new file mode 100644
index 0000000..7c46474
--- /dev/null
+++ b/src/__tests__/__snapshots__/imported-spread-test.js.snap
@@ -0,0 +1,9 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`imported-spread 1`] = `
+"'use strict';
+
+var _other_module = require('./other_module');
+
+var React = require('react');"
+`;
diff --git a/src/__tests__/imported-spread-test.js b/src/__tests__/imported-spread-test.js
new file mode 100644
index 0000000..cf6d494
--- /dev/null
+++ b/src/__tests__/imported-spread-test.js
@@ -0,0 +1,24 @@
+const babel = require('babel-core');
+const content = `
+var React = require('react');
+import { type Foo } from './other_module';
+
+type Props = {|
+  id: string,
+  ...Foo,
+|}
+`;
+
+it('imported-spread', () => {
+  const res = babel.transform(content, {
+    babelrc: false,
+    presets: ['es2015', 'stage-1', 'react'],
+    plugins: ['syntax-flow', require('../')],
+  }).code;
+  
+  // The type shouldn't show up as we don't support
+  // spreads from imports
+  expect(res).not.toMatch(/Foo/);
+
+  expect(res).toMatchSnapshot();
+});
\ No newline at end of file
Repository: xiCO2k/laravel-vue-i18n (ts)
Issue: Multiple occurrences of variable
I have a string with for example,

`Do you really want to block :name. After this :name won't be able to message you.`

First occurrence of :name is translated, second is not.

I used it in the following sentence:

`'Weet je zeker dat je :name wilt deblokkeren? :name kan dan weer berichten sturen.'`

Results in the following:

`Weet je zeker dat je adsasd wilt deblokkeren? :name kan dan weer berichten sturen.`

Thanks for the great plugin! 
Pull request description: fix: Allow multiple occurrences replacements
Fixes #91.

Patch:
diff --git a/src/index.ts b/src/index.ts
index 635032f..bba81e2 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -385,9 +385,9 @@ export class I18n {
       value = value.toString()
 
       message = message
-        .replace(`:${key}`, value)
-        .replace(`:${key.toUpperCase()}`, value.toUpperCase())
-        .replace(`:${capitalize(key)}`, capitalize(value))
+        .replace(new RegExp(`:${key}`, 'g'), value)
+        .replace(new RegExp(`:${key.toUpperCase()}`, 'g'), value.toUpperCase())
+        .replace(new RegExp(`:${capitalize(key)}`, 'g'), capitalize(value))
     })
 
     return message


Test patch:
diff --git a/test/fixtures/lang/pt.json b/test/fixtures/lang/pt.json
index 9c15cf0..4afd8fe 100644
--- a/test/fixtures/lang/pt.json
+++ b/test/fixtures/lang/pt.json
@@ -1,6 +1,7 @@
 {
     "Welcome!": "Bem-vindo!",
     "Welcome, :name!": "Bem-vindo, :name!",
+    "hi :name, hi :name": "olá :name, olá :name",
     "{1} :count minute ago|[2,*] :count minutes ago": "{1} há :count minuto|[2,*] há :count minutos",
     "foo.bar": "baz",
     "Start/end": "Início/Fim",
diff --git a/test/translate.test.ts b/test/translate.test.ts
index 80d8a46..8855399 100644
--- a/test/translate.test.ts
+++ b/test/translate.test.ts
@@ -61,6 +61,12 @@ it('translates key with values with $t mixin', async () => {
   expect(wrapper.html()).toBe('<h1>Bem-vindo, Francisco!</h1>')
 })
 
+it('replaces multiple occurrences with $t mixin', async () => {
+  const wrapper = await global.mountPlugin(`<h1>{{ $t('hi :name, hi :name', { name: 'Francisco' }) }}</h1>`);
+
+    expect(wrapper.html()).toBe('<h1>olá Francisco, olá Francisco</h1>')
+})
+
 it('translates key with values with "trans" helper', async () => {
   await global.mountPlugin();
 
@@ -68,6 +74,13 @@ it('translates key with values with "trans" helper', async () => {
     .toBe('Bem-vindo, Francisco!')
 })
 
+it('replaces multiple occurrences with "trans" helper', async () => {
+  await global.mountPlugin();
+
+  expect(trans('hi :name, hi :name', { name: 'Francisco' }))
+    .toBe('olá Francisco, olá Francisco')
+})
+
 it('loads a lang', async () => {
   const wrapper = await global.mountPlugin(`<h1>{{ $t('Welcome, :name!', { name: 'Francisco' }) }}</h1>`, 'en');
 
@@ -204,4 +217,4 @@ it('does not translate existing strings which contain delimiter symbols', async
 
   expect(trans('Start/end')).toBe('Início/Fim');
   expect(trans('Get started.')).toBe('Comece.');
-})
\ No newline at end of file
+})