Unable to extend ERC1155Upgradeable `_update` function - Compiler Error

Hello @sasha, thanks for reporting. Let me give some context first:

In the recent 5.0 release, we removed the interfaces and libraries from the upgradeable contracts (@openzeppelin/contracts-upgradeable) and instead, we now import them from the main repository (@openzeppelin/contracts). You can learn more about this decision here.

If you take a look at the ERC1155Upgradeable in Remix and you'll notice some relative imports and some absolute ones following this change:

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.20;

import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
...
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
...

Now, regarding your problem, if you've been using Remix previously, it's likely some 4.9.3 contracts were cached in Remix and these import changes are messing up at some point. You can solve this by either one of the following options:

  1. Delete the .deps folder in Remix, this will clear and redownload the packages, avoiding any cached version mismatch
  2. Since libraries and dependencies are cached by workspaced, you can create a new workspace and migrate your contracts there to freshly download all versions

Another alternative is to specify the Contracts version with:

import "@openzeppelin/contracts@5.0.0/...";

But it won't likely work because of the internal absolute imports inside ERC1155Upgradeable.sol.