  We study the relation between the chemical composition and the type of dust
present in a group of 20 Galactic planetary nebulae (PNe) that have high
quality optical and infrared spectra. The optical spectra are used, together
with the best available ionization correction factors, to calculate the
abundances of Ar, C, Cl, He, N, Ne, and O relative to H. The infrared spectra
are used to classify the PNe in two groups depending on whether the observed
dust features are representative of oxygen-rich or carbon-rich environments.
The sample contains one object from the halo, eight from the bulge, and eleven
from the local disc. We compare their chemical abundances with nucleosynthesis
model predictions and with the ones obtained in seven Galactic H II regions of
the solar neighbourhood.
  We find evidence of O enrichment (by $\sim$ 0.3 dex) in all but one of the
PNe with carbon-rich dust (CRD). Our analysis shows that Ar, and especially Cl,
are the best metallicity indicators of the progenitors of PNe. There is a tight
correlation between the abundances of Ar and Cl in all the objects, in
agreement with a lockstep evolution of both elements. The range of
metallicities implied by the Cl abundances covers one order of magnitude and we
find significant differences in the initial masses and metallicities of the PNe
with CRD and oxygen-rich dust (ORD). The PNe with CRD tend to have intermediate
masses and low metallicities, whereas most of the PNe with ORD show higher
enrichments in N and He, suggesting that they had high-mass progenitors.
