I wonder whether the use of the merge-relation in an UML package diagram might lead to multiple inheritance.
Specifically, I was thinking about the following situation:
A package containing a class and its subclass is merged into another package.
Lets assume we have a Package "P1" which contains two classes "A" and "B". "A" inherits from "B". We are trying to merge this package "P1" into a package "P2".
Will this lead to Package "P2" containing a Class "P1::A", which inherits from a class "A" and at the same time inherits from a class "P1::B" (which inherits from a class "B")?
Let's consider your merge example:
The package P2 contains a class B and a class A inheriting from that B. Since there are no A nor B defined, the P2 classes are deep copies of the ones defined in P1 in view of the following UML transformation rule:
But what is the relationship between the resulting class A in P2 and the class A in P1? You assumed inheritance and therefore saw multiple inheritance. This sounds logic, as one would expect that instances of P2::A are also instances of P1::A, which would look like inheritance. But this is not what the UML specs say. Both types share their unqualified name, and are simply substitutable, without any inheritance:
It's somewhat difficult to see in practice, as many languages do not allow substitutability outside the context of inheritance or interface realization. Moreover, the UML specs add to the confusion by making a comparison between merge and inheritance, to conduct some reasoning by analogy.
By the way, this conclusion regarding your question does not mean that merge can never lead to multiple inheritance, as the following example shows: