Repository: facebook/react
File: compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts (TypeScript)

Code before:
    jsxSpreadAttributes.length === 1;

  propAttributes.forEach(prop => {
    switch (prop.kind) {
      case 'JsxAttribute': {
        switch (prop.name) {
          case 'key': {
            keyProperty = {
              kind: 'ObjectProperty',
              key: {name: 'key', kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
            break;
          }
          // In the current JSX implementation, ref is both
          // a property on the element and a property on props.
          // Intentional fallthrough to push into props.
          // @ts-expect-error
          case 'ref': {
            refProperty = {
              kind: 'ObjectProperty',
              key: {name: 'ref', kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
          }
          default: {
            const attributeProperty: ObjectProperty = {
              kind: 'ObjectProperty',
              key: {name: prop.name, kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
            props.push(attributeProperty);
          }
        }
        break;
      }
      case 'JsxSpreadAttribute': {
        props.push({
          kind: 'Spread',
          place: {...prop.argument},
        });
        break;
      }
    }
  });

  const propsPropertyPlace = createTemporaryPlace(fn.env, instr.value.loc);
  if (children) {

Review comment (suggestion):
reusing the object property means reusing the Place instances, which is invalid. let's remove the fallthrough and just assign to both `refProperty` and push to `props` with distinct object property values and places

Code after:
    jsxSpreadAttributes.length === 1;

  propAttributes.forEach(prop => {
    switch (prop.kind) {
      case 'JsxAttribute': {
        switch (prop.name) {
          case 'key': {
            keyProperty = {
              kind: 'ObjectProperty',
              key: {name: 'key', kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
            break;
          }
          case 'ref': {
            /**
             * In the current JSX implementation, ref is both
             * a property on the element and a property on props.
             */
            refProperty = {
              kind: 'ObjectProperty',
              key: {name: 'ref', kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
            const refPropProperty: ObjectProperty = {
              kind: 'ObjectProperty',
              key: {name: 'ref', kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
            props.push(refPropProperty);
            break;
          }
          default: {
            const attributeProperty: ObjectProperty = {
              kind: 'ObjectProperty',
              key: {name: prop.name, kind: 'string'},
              type: 'property',
              place: {...prop.place},
            };
            props.push(attributeProperty);
          }
        }
        break;
      }
      case 'JsxSpreadAttribute': {
        props.push({
          kind: 'Spread',
          place: {...prop.argument},